# 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.

- Page: https://tecyfy.com/concepts/plannerexecutor-pattern
- Subject: AI agents (https://tecyfy.com/concepts)
- Level: intermediate
- Also called: Plan and Execute, Plan-and-Execute Agent, Orchestrator-Workers, ReWOO

A step-by-step agent, the [ReAct loop](https://tecyfy.com/concepts/react-pattern), 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 [subagents](https://tecyfy.com/concepts/subagent) 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:

1. Query the refunds table for both quarters, grouped by product.
2. Query the orders table for the same, to get the totals.
3. 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.

## Related

- [Agent](https://tecyfy.com/concepts/agent): A model that uses tools in a loop, deciding each next step from what the last one returned, until the task is done.
- [ReAct Pattern](https://tecyfy.com/concepts/react-pattern): An 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.
- [Subagent](https://tecyfy.com/concepts/subagent): An agent started by another agent for one part of a task. It works in its own fresh context and returns only its findings.
- [Orchestration](https://tecyfy.com/concepts/orchestration): Running the steps of data pipelines in the right order and at the right time, retrying failures and alerting someone when a step breaks.
- [Agentic Workflow](https://tecyfy.com/concepts/agentic-workflow): A fixed sequence of model calls and tools that your code controls, such as classify, then look up, then draft. An agent decides its own next steps; a workflow follows the path you wrote.

## Sources

- [ReWOO: Decoupling Reasoning from Observations for Efficient Augmented Language Models](https://arxiv.org/abs/2305.18323)
- [Building effective agents](https://www.anthropic.com/engineering/building-effective-agents)
- [How we built our multi-agent research system](https://www.anthropic.com/engineering/multi-agent-research-system)
