Planner-Executor Pattern
Separate planning from execution. The planner creates a step-by-step plan; the executor runs each step. Key advantage: the plan is inspectable and modifiable by humans before execution.
Why separate planning from execution?
| BENEFIT | HOW |
|---|---|
| Human review | Show the plan to the user before running it. "I'm going to do these 4 steps. Proceed?" |
| Cost prediction | Plan tells you how many steps → predict token cost before execution |
| Better debugging | If step 3 fails, you know exactly what went wrong. Re-run from step 3, not from scratch |
| Re-planning | If step 2 returns unexpected data, re-plan remaining steps without restarting |
| Parallelism | Independent steps (1 and 2 have no dependencies) can run in parallel |
Production implementation with re-planning
Continue Reading
This topic continues with more in-depth content, code examples, and diagrams. Sign up free to unlock the full guide with all 87 sections.
Sign Up Free to UnlockFree access · No credit card required