Planner-Executor Pattern
The planner-executor pattern separates planning from execution, using one agent (or phase) to create plans and another to carry them out.
What Problem It Solves
When a single agent both plans and executes, several issues arise:
- Context pollution: Planning context interferes with execution context
- Mode confusion: The agent may switch between planning and acting inconsistently
- Evaluation difficulty: Hard to assess whether failures stem from bad plans or bad execution
- Specialization limits: Different capabilities may be optimal for planning vs. execution
The planner-executor pattern addresses these by assigning responsibilities to separate components.
How It Works
Planner Agent Receives the high-level goal and produces a structured plan—a sequence of steps with descriptions, expected inputs/outputs, and success criteria. The planner doesn't execute; it only reasons about what should be done.
Executor Agent Receives individual plan steps and executes them. The executor focuses on carrying out specific actions without concern for overall strategy. It reports results back for evaluation.
Coordinator Manages the interaction: feeds goals to planner, distributes plan steps to executor(s), tracks progress, handles failures, and determines when re-planning is needed.
When to Use / When to Avoid
Use when: - Tasks require distinct planning and execution capabilities - You need clear separation for debugging and evaluation - Plans can be meaningfully specified before execution - You have sufficient task volume to justify the complexity
Avoid when: - Tasks are simple enough for single-agent handling - Plans cannot be specified without execution feedback (highly exploratory tasks) - Latency is critical (separation adds coordination overhead) - You're in early prototyping (simpler approaches validate faster)
Failure Modes
Over-specified plans: Plans too detailed constrain executor flexibility, breaking on unexpected situations.
Under-specified plans: Plans too vague give executor insufficient guidance, leading to inconsistent execution.
Plan-reality mismatch: Plans assume conditions that don't hold during execution.
Re-planning avoidance: System continues with outdated plans rather than adapting.
Coordination overhead: For simple tasks, the pattern adds complexity without benefit.
Esy Implementation Example
In Esy's research workflows, the planner-executor pattern appears in the Research Agent:
Research Planner analyzes the user's question and produces a research plan: what sources to consult, what sub-questions to investigate, what evidence would answer the question.
Research Executor takes individual plan items and executes them: searching sources, evaluating documents, extracting relevant information.
A Coordinator tracks which plan items are complete, aggregates findings, and triggers re-planning when initial research reveals the question needs refinement.
This separation allows the planner to use models optimized for reasoning while executors use models optimized for tool use and extraction.