What is the planner-executor pattern for AI agents, and when is it better than a step-by-step loop?
An agent design that splits the work in 2. A planner writes the whole plan first, and an executor, which can be cheaper code or smaller models, carries out each step. The plan is changed only when a step fails.
intermediate · Also called Plan and Execute, Plan-and-Execute Agent, Orchestrator-Workers, ReWOO
A step-by-step agent, the ReAct loopReAct PatternAn agent design where the model alternates between reasoning about what to do next and taking an action, such as a tool call, then reads the result before deciding again. Most agent loops today follow it., decides one action at a time: call a tool, read the result, decide the next call. Every decision is a call to the large model, with the whole conversation resent each time. The planner-executor pattern decides most of it once, up front.
A planner, usually the most capable model, reads the task and writes a plan: the steps, in order, with what each needs. An executor carries the steps out. The executor can be plain code calling tools, a smaller and cheaper model, or a set of subagentsSubagentAn agent started by another agent for one part of a task. It works in its own fresh context and returns only its findings. working in parallel. The planner is called again only when a step fails or a result changes what should happen next.
A small example
Asked "Compare our refund rate this quarter with last quarter, by product", a planner might write:
- Query the refunds table for both quarters, grouped by product.
- Query the orders table for the same, to get the totals.
- Divide, and list the products whose rate rose the most.
Steps 1 and 2 do not depend on each other, so they can run at once. Step 3 is arithmetic, which code does more reliably than a model.
What it buys, and what it costs
A 2023 method called ReWOO planned all its tool calls before seeing any result, and reported 5 times better token efficiency than step-by-step reasoning, with 4% higher accuracy, on a question-answering benchmark, HotpotQA. The plan also makes the agent easier to check: a person can read it, approve it, or spot the wrong step before anything runs.
The cost is flexibility. A plan written before the first result can be wrong about the world: if step 1 finds no refunds table, the rest of the plan is useless. Good planner-executors re-plan when a step fails rather than pushing on.
Where you meet it
Anthropic calls the same shape orchestrator-workers, and its Research feature works this way: a lead agent plans the research and starts subagents that search in parallel. Its engineers found the delegation itself needs care, since each worker needs an objective, an output format, the tools and sources to use and clear boundaries; without them workers repeat each other or leave gaps. Their general advice still applies first: start with the simplest design that works, and split planning from doing only when a simpler loop is shown to fall short.
Sources