Planner–Executor
Plan-and-solve · Descomposición
Escrito por Darjus Kazakevic · revisado el
Write the plan down before anything happens.
An agent loop decides one step at a time, so you only see its route after it has acted. For work that is costly, cannot be undone, or needs someone's approval, that is too late.
Planner–Executor splits deciding from doing. One call turns the goal into a list of steps. Then each step runs on its own, often on a cheaper model or as plain code. The cost is flexibility: the plan uses only what was known at the start, so you need a clear rule for when to re-plan.
En esencia — An explicit plan gives you what a step-by-step loop cannot: a route you can read, price and reject before the first side effect.
Cuándo recurrir a él
Recurre a él cuando
- Someone must approve the work before it starts
- Steps are costly or irreversible, so seeing the route afterwards is too late
- Most steps are simple enough for a much cheaper model
Reconsidéralo cuando
- Each result changes what the next step should be — use the loop
- The task is short; three turns do not need a plan
- The steps never change — write a fixed pipeline instead
The parts
- The plan
- An ordered list of steps, produced before anything runs. Its value is that it is data: you can print it, compare it, price it and show it to a reviewer.
- The step
- One unit of work, stated clearly enough to run without the rest of the plan. It lists its inputs and says whether it changes anything, which decides whether it needs approval.
- The executor
- What runs a step: usually a smaller model, sometimes a plain function, sometimes a small agent loop for that one step. The hard reasoning already happened in the plan, so this half is where you save money.
- The re-plan trigger
- The explicit condition that drops the remaining steps and makes a new plan. Without one, the plan cannot notice it is wrong. With too loose a one, it re-plans constantly and costs more than a loop.
Reglas de diseño
- Make the plan structured data
- Emit the plan through a schema, not as a numbered paragraph. Then you can store it, price it, compare it with the last attempt and show it to a reviewer — once, instead of approving eleven tool calls.
- Plan in task words, not tool names
- “Check refund eligibility” survives a tool rename; call_get_order_v2 does not. Task words also make the plan readable for the person who approves it. List each step's inputs, so it can run alone.
- Run the steps on a cheaper model
- Breaking down the goal is the hard reasoning. Running a clear step usually is not. A strong model for the plan and a small one for the steps is where most of the savings come from.
- Define when to re-plan, and cap it
- Decide up front what makes the plan wrong: a failed step, a surprising result, more work than expected. Without a rule, you either finish a broken plan or re-plan after every step.
Errores habituales
- No re-plan rule, so a plan broken at step two still runs to step nine.
- Planning in tool names, so renaming a tool breaks the planner's prompt.
- Steps too vague to run alone, so every executor call needs the whole plan.
- Using the same expensive model for both halves, which removes most of the benefit.