Skip to main content

Plan-and-Execute

Separates reasoning into two distinct phases: a planner creates a high-level plan upfront, and an executor works through it step by step. If a step fails or new information emerges, the plan can be revised. This prevents the agent from losing sight of the overall goal while deep in execution.


Structure

The planner sees the full goal. The executor focuses on one step at a time. If execution reveals the plan is wrong, control returns to the planner for revision.


How It Works

  1. Plan — planner LLM analyzes the goal and produces an ordered list of steps
  2. Execute — executor works through steps one at a time (often using ReAct per step)
  3. Track — progress is tracked against the plan (completed, in-progress, pending)
  4. Replan — if a step fails or produces unexpected results, the planner revises the remaining steps
  5. Complete — when all steps are done, results are assembled into the final output

The planner and executor can be:

  • The same model with different prompts
  • Different models (cheap model for planning, capable model for execution)
  • Different agents with different tool access

Key Characteristics

  • Goal-oriented — the plan keeps the agent focused on the overall objective
  • Recoverable — replanning handles unexpected situations without starting over
  • Separation of concerns — planning and execution are independent cognitive tasks
  • Overhead — planning step adds latency before any execution begins
  • Plan quality matters — bad plans lead to wasted execution cycles

When to Use

  • Long-horizon tasks with many steps (research, multi-file code changes, data pipelines)
  • The agent tends to lose track of the overall goal during execution
  • Tasks benefit from upfront decomposition before diving into details
  • You need progress tracking against a plan
  • Failures in one step should trigger intelligent replanning, not just retries