Grit
  • Welcome
  • gritholdings SDK
    • API Reference
    • Collection of Useful Prompts
  • Evaluation
    • Evaluators
  • Concepts
  • LangChain
  • LangGraph
  • Agent Architectures
    • Planner-Worker-Solver
  • Prompt Management
  • Memory
  • Guardrails
  • Others
    • AWS
      • AWS CDK
    • Migrating a Service to Docker
    • React
    • Salesforce
      • Object Reference
      • Writing Apex
      • Experience Cloud
    • Grit API Reference
    • Style Guide for Documentation and User Interface Text
Powered by GitBook
On this page
  • Overview
  • Code Examples
  • Architecture
  • 1. Planner
  • 2. Worker
  • 3. Solver
  • Benefits
  1. Agent Architectures

Planner-Worker-Solver

PreviousAgent ArchitecturesNextPrompt Management

Last updated 8 months ago

Overview

This paradigm combines a multi-step planner and variable substitution for efficient tool use. It improves upon the ReACT-style agent architecture by reducing token consumption, execution time, and simplifying the fine-tuning process. It was introduced in .

Code Examples

Architecture

Planner-worker-solver architecture consists of three main modules:

1. Planner

The Planner module generates a plan in the following format:

plan: <reasoning>
tool: Google
input: <query>
step_name: step#1

plan: <reasoning>
tool: LLM
input: <query>
step_name: step#2
...

The Planner generates the full chain of tools used in a single pass, thereby reducing the number of LLM calls and avoiding redundant prefixes (system prompt and previous steps) required for each reasoning step in ReACT-style architectures.

2. Worker

The Worker module executes the tools with the provided arguments generated by the Planner. It performs the actual tool invocations and returns the observations.

3. Solver

The Solver module generates the answer for the initial task based on the tool observations obtained by the Worker. This module depends on an LLM call to produce the final answer.

Benefits

1. Reduced Token Consumption and Execution Time

By generating the full chain of tools in a single pass, this paradigm reduces the number of LLM calls and eliminates the need for redundant prefixes (system prompt and previous steps) at each reasoning step. This leads to reduced token consumption and faster execution compared to ReACT-style architectures.

2. Simplified Fine-tuning Process

The planning data does not depend on the outputs of the tools. This allows for fine-tuning the models without actually invoking the tools, simplifying the fine-tuning process compared to ReACT-style architectures.

3. Variable Substitution

This paradigm employs variable substitution to avoid redundant calls to the Planner LLM. The arguments for subsequent tools can reference the outputs of previous tools using variables (e.g., step#1), which are substituted with their actual values during execution.

For comparison, see .

ReWOO
Planner-worker-solver architecture
Planner-Worker-Solver Versus Plan-and-Execute