Plan and Execute is a pattern that separates planning from execution. A planner agent breaks a complex task into an ordered list of subtasks, and an executor agent carries them out one by one, with optional re-planning if intermediate results change the approach.
At a Glance
- Problem: An agent choosing one step at a time can wander, revisit information, and make far more API calls than needed, because the same loop mixes deciding the overall approach with deciding the very next action.
- Forces: An upfront plan cuts wasted exploration, but plans go stale when results surprise you; replanning restores adaptivity, but frequent replanning costs more tokens than it saves; steps need enough detail to guide the executor without constraining it.
- Solution: A planner decomposes the task into ordered steps, an executor carries out each step with the available tools, and results can flow back to the planner so it revises the remaining steps.
- Consequences: Gains: structured progress, less wasted exploration, a plan humans can review before it runs, and focused context for each role. Costs: an extra LLM call before any work begins, plan state to maintain, and brittleness if replanning is weak.
What problem does Plan and Execute solve?
Agents that decide what to do one step at a time can wander. The ReAct pattern works well for many tasks, but because the agent chooses its next action based only on what it has seen so far, it can explore unproductive paths, revisit the same information, or miss the most efficient route to a solution. Each step looks reasonable on its own while the run as a whole can waste calls.
Consider an agent asked to research a set of competitors and produce a summary report. A purely reactive agent might search for one competitor, go deep on their pricing page, get distracted by a tangential product feature, search for another competitor, realize it forgot to check the first competitor's funding history, and backtrack. It eventually produces a result, but it made twice as many tool calls as necessary and re-sent its growing transcript on every step, which in the worked example below costs almost four times as much as a planned run.
Underneath this, a reactive agent mixes strategy with execution. The same agent decides both "what is the overall approach" and "what is the very next action," two different kinds of decision, and in a single loop neither gets enough attention.
How does Plan and Execute work?
Plan and Execute separates these two concerns into distinct phases with distinct roles. A planner agent looks at the full task and produces a structured plan: a sequence of steps that, when completed, will solve the problem. An executor agent then works through the plan one step at a time.
The planner operates at a high level. It decomposes the task, identifies dependencies between steps, and produces something resembling a checklist or workflow. It does not execute anything; it decides what needs to happen and in what order.
The executor operates at a low level. It takes a single step from the plan, figures out how to accomplish it using available tools, and returns the result. It ignores the big picture and handles the step in front of it.
After each step completes, the system can optionally send the results back to the planner for review. The planner might revise the remaining steps based on what the executor discovered. Maybe the first research step revealed that one competitor was acquired last month, so the planner removes that competitor from the remaining analysis steps and adds the acquiring company instead. Replanning lets the plan change when the facts do.
The separation also saves tokens. The planner needs to see the full task description and the current state of progress, but it does not need to see the detailed execution traces. The executor needs the current step instructions and relevant tool outputs, but it does not need to carry the entire plan in its context. Each agent gets a focused context window with only the information it needs.
When should you use Plan and Execute?
This pattern fits best when the task has a clear structure that benefits from upfront decomposition.
Strong signals:
- The task involves multiple distinct phases that build on each other (research, then analysis, then writing)
- You can estimate the steps needed before starting execution
- The task is expensive in API calls, and wasted exploration hurts your budget
- You need a visible progress indicator, and the plan itself can serve as a progress bar
- The task benefits from human review of the plan before execution begins
Weaker signals where a simpler ReAct loop might be sufficient:
- The task is exploratory and you cannot predict the path to a solution
- The task is simple enough to complete in two or three steps
- The environment changes rapidly and plans become stale before they can be executed
When not to use it: when the sequence of steps is fixed and never changes between runs, hard-code it with Prompt Chaining rather than asking a planner to rediscover it each time. If the planner cannot be told the executor's real tool inventory, it will plan steps nobody can perform, so a ReAct Loop that reacts to actual tool results is safer. For interactive requests where users expect immediate visible progress, the front-loaded planning call can make the system feel slow.
Worked Example: Cost and Latency
An agent writes 500 competitor research briefs a day on the large model.
| Setup | LLM calls | Tool calls | Tokens per request (in / out) | Cost per 1,000 requests | Latency per request |
|---|---|---|---|---|---|
| ReAct loop | 13 | 12 | 109,200 / 2,400 | $363.60 | 46.5 s |
| Plan and Execute | 14 | 6 | 20,100 / 2,400 | $96.30 | 47.0 s |
Assumptions: as in the example above, the reactive agent makes twice as many tool calls as the plan needs. The task prompt is 1,500 tokens, each tool result 1,000 tokens, each ReAct Thought 150 tokens, and the final report 600 tokens. The planner writes a 300-token plan. Each executor step sees only an 800-token step brief: one call emits the tool call (50 tokens) and a second reads the result and writes a 200-token summary. The final call reads the task plus six summaries (2,700 tokens). Tool execution time is excluded; at 2 s per call it would add 24 s to ReAct and 12 s to Plan and Execute.
ReAct re-sends its growing transcript, so its last call alone reads 15,300 tokens: 109,200 input × $3.00 per million = $0.3276, plus 2,400 output × $15.00 per million = $0.036, so $363.60 per 1,000. Plan and Execute reads 20,100 tokens ($0.0603) and writes the same 2,400, so $96.30. Latency is 5.5 + 6 × 5.17 + 10.5 ≈ 47.0 s against 12 × 3.0 + 10.5 = 46.5 s.
The saving here comes from focused contexts and shows up in cost. Latency only drops if independent steps run in parallel, and each replanning call eats into the gap.
What are the common pitfalls?
Rigid plans that do not adapt. If the planner creates a plan and the executor follows it blindly regardless of what it discovers, the system becomes brittle. A step might fail or return unexpected results that invalidate the rest of the plan. Without replanning, the executor wastes effort on steps that no longer make sense. Always include a feedback loop where execution results inform the planner.
Over-planning. Some tasks do not decompose neatly into sequential steps. Forcing a detailed plan on an exploratory task adds overhead and buys nothing. The planner spends tokens producing a plan that will need heavy revision after almost every step. If you find yourself replanning more often than executing, the task might be better suited to a reactive approach.
Plan granularity mismatch. Plans that are too high-level give the executor insufficient guidance. Plans that are too detailed constrain the executor unnecessarily and bloat the planner's output. You will need to experiment to find the right level. As a rule of thumb, each step should take one to three tool calls.
Planner hallucinating capabilities. The planner might include steps that assume tools or data sources the executor does not have access to. If the planner is not aware of the executor's actual capabilities, it will produce plans that cannot be executed. Share the tool inventory with the planner so it knows what is possible.
Cascading failures. When an early step fails, all downstream steps that depend on it will also fail. The system needs a plan for step failures: retrying the failed step, revising the plan to work around the failure, or escalating to a human.
What are the trade-offs?
You gain structured progress, reduced wasted exploration, visible execution plans that can be reviewed before running, and a clean split between deciding the approach and carrying it out.
You pay with the overhead of generating a plan (additional LLM call before any execution happens), the complexity of maintaining plan state and handling replanning, and the risk of rigidity if replanning is not implemented well.
Latency is front-loaded. The planning phase adds time before any visible work begins. For interactive applications, users might perceive the system as slow because nothing happens while the plan is being generated. Consider streaming the plan to the user as it is created.
Total token cost can be higher or lower than ReAct. If the plan is good and the executor follows it efficiently, you save tokens by avoiding wasted exploration. If the plan is poor and requires frequent revision, you spend extra tokens on both planning and replanning without saving on execution.
This pattern works best at the middle complexity range. Simple tasks do not need a plan, and very complex or novel tasks resist planning because nobody understands the problem well enough upfront. It fits best on tasks where you roughly know what needs to happen but the details require careful execution.
Goes Well With
Chain of Thought helps the planner reason through how to break the task down. By explicitly working through the problem structure before producing a plan, the planner creates better step sequences with fewer gaps and dependencies.
ReAct Loop serves as the execution engine within each step. While Plan and Execute handles the high-level structure, each individual step can use a ReAct loop to figure out the tactical details of how to accomplish it. You get a plan at the top level and flexible execution inside each step.
Multi-Agent Collaboration extends this pattern by assigning different plan steps to different specialist agents. The planner becomes a supervisor that delegates each step to the agent best suited for that type of work, combining the structure of planning with the expertise of specialized agents.
References
- Wang, L., et al. (2023). Plan-and-Solve Prompting: Improving Zero-Shot Chain-of-Thought Reasoning by Large Language Models. ACL 2023. arXiv
- Yao, S., et al. (2023). Tree of Thoughts: Deliberate Problem Solving with Large Language Models. NeurIPS 2023. arXiv
Further Reading
- Wang et al., "Plan-and-Solve Prompting: Improving Zero-Shot Chain-of-Thought Reasoning by Large Language Models" (2023). Shows that explicitly decomposing problems into a plan before solving each step improves reasoning accuracy over standard chain-of-thought approaches. arXiv:2305.04091