← Back to docs
Recipe
Planner + executor agent split
Separate reasoning from action. The planner decides what to do; the executor carries it out with tool access and a tight feedback loop.
Overview
This recipe splits a single agent into two cooperating roles. The planner receives the user request, breaks it into a sequence of discrete steps, and hands the plan to the executor. The executor runs each step, calling tools as needed, and reports results back. If a step fails, the planner revises the remaining plan.
When to use
- Multi-step tasks where tool selection depends on prior results.
- Expensive reasoning models — keep the planner small and focused.
- Tasks that benefit from a human-readable plan before execution.
- Long-running workflows where the plan may need mid-flight revision.
Structure
User → Planner
↓ plan
Executor
↓ tool calls
Tools (browser, code, search)
↓ result
Executor → Planner (revise?)
↓ final
UserKey parameters
| Parameter | Default | Notes |
|---|---|---|
| max_plan_steps | 8 | Hard cap on plan length |
| executor_retries | 2 | Retries per step before replan |
| planner_model | sonnet | Model used for reasoning |
Next steps
Pair this recipe with the tool router pattern for dynamic tool selection, or add a human-in-the-loop gate before the executor runs expensive operations.