While ReAct prompting is great for dynamic problems, it is inherently short-sighted. The agent decides its next action based only on its immediate observation, which often leads to infinite loops or losing track of the overarching goal. The Plan-and-Solve architecture splits cognitive labor into two distinct phases. First, a 'Planner' model receives the user's objective and outputs a rigid, step-by-step plan (often a Directed Acyclic Graph of dependencies). Second, a 'Worker' model simply executes those steps sequentially, passing the output of step 1 as the input to step 2. This significantly reduces API costs and prevents the agent from spiraling off-topic.

How It Works

  • Planning Phase: An LLM writes out a numbered list of sub-tasks required to fulfill the user's request.
  • Execution Loop: A separate prompt (or separate specialized agent) is given Task 1 and the necessary tools.
  • State Management: The results of Task 1 are appended to the system memory. Task 2 is then executed using the context gained from Task 1.
  • Completion: Once all tasks in the plan are crossed off, a final response is generated.

Common Use Cases

  • Automated software engineering where file creation, coding, and testing must happen in a specific order.
  • Complex data analysis pipelines requiring multiple distinct API queries.

Related Terms