Planner-Executor Agent
Split a task into an explicit plan, execute steps one at a time, and re-plan only when a step fails.
Separating planning from execution makes long tasks more reliable and cheaper: a strong model plans once, a cheaper model can execute individual steps.
Steps
- Plan: ask the planner model for a JSON list of steps, each with
id,goal, anddone_when. - Execute: for each step, give the executor only the overall goal, the current step, and results of prior steps.
- Check: verify the step against
done_when(programmatically where possible). - Re-plan: on failure, send the plan, completed results, and the error back to the planner for a revised remaining plan.
- Finish: synthesize a final answer from step results.
Planner prompt
You are a planner. Break the user's goal into 3-8 sequential steps.
Return ONLY JSON: {"steps":[{"id":1,"goal":"...","done_when":"..."}]}
Each step must be independently executable and verifiable.
Do not include steps that require information the user has not provided
unless a tool can obtain it. Goal: {{goal}}Control flow
max_replans: 2
planner_model: strong-reasoning-model
executor_model: fast-cheap-model
on_step_failure: replan
on_replan_exhausted: return_partial_with_errorFailure modes
- Plans that are too coarse or too fine waste steps; tune step granularity.
- Executor failures without replanning leave tasks half done.
- Unbounded replanning loops; cap replans.
Markdown version: /blueprints/planner-executor.md
Want a deeper build of this?
Vote for an extended, fully tested version (more tools, a full workflow file). Votes decide what we build next.
Get one fully built blueprint a week
A weekly email: one blueprint with config, cost, setup time and failure modes, plus a vote on what we build next.
Related blueprints
Agent Tracing and Evaluation Setup
Capture structured traces of every LLM and tool call and run a small regression eval suite on each change.
Evaluator-Optimizer Refinement Loop
One model generates, another grades against a rubric, and the loop repeats until the rubric passes or a limit is hit.
Human-in-the-Loop Approval Gate
Let agents draft freely but require explicit human approval before any irreversible or external action.