ReWOO and Plan-and-Execute: Decoupled Planning
ReAct interleaves thought and action in one stream. ReWOO splits them: plan once up front, then execute. On HotpotQA that bought about 5x fewer tokens and +4 accuracy, and the planner can be distilled into a 7B model. Plan-and-Execute generalized the idea, and Plan-and-Act scaled it to web navigation.
Learning Objectives
- Explain why ReWOO's Planner / Worker / Solver split saves tokens and improves robustness over ReAct's interleaved loop.
- Implement a plan DAG, a dependency-ordered executor, and a solver that composes worker outputs, all in stdlib.
- Decide when a task should run as plan-then-execute vs interleaved ReAct, using the 2026 "five workflow patterns" framing (Anthropic).
- Recognize when Plan-and-Act's synthetic plan data is needed for long-horizon web or mobile tasks.
The Problem
ReAct's interleaved thought-action-observation loop is simple and flexible, but every tool call has to carry the full prior context, including each earlier thought. Each step's prompt grows linearly with depth, so total tokens billed across a run grow quadratically. Failures are worse. When a tool breaks mid-loop, the model has to re-derive the whole plan from one error observation.
ReWOO (Xu et al., arXiv:2305.18323, May 2023) bets the other way: plan everything up front, fetch evidence in parallel, compose the answer at the end. That's one LLM call to plan, N tool calls for evidence (which can run in parallel), and one LLM call to solve. You give up flexibility because the plan is static. In return you get far better token efficiency and failures you can actually locate.
The Concept
ReWOO (Reasoning WithOut Observation) is an agent pattern that separates planning from tool execution. A planner writes the full plan before any tool runs, workers carry it out, and a solver turns the collected evidence into an answer. Plan-and-Execute and Plan-and-Act are descendants of it.
The three roles
Planner: user_question -> [plan_dag]
Workers: [plan_dag] -> [evidence] (tool calls, possibly parallel)
Solver: user_question, plan_dag, evidence -> final_answer
The planner produces a DAG. Each node names a tool, its arguments, and which earlier nodes it depends on, using references like #E1 and #E2. Workers execute the nodes in topological order. The solver stitches the results together.
Why 5x fewer tokens
ReAct's prompt grows linearly with step count, which makes cumulative tokens across a run grow quadratically. At step 10, the prompt holds thought 1, action 1, observation 1, thought 2, action 2, observation 2, and so on, and every intermediate step also repeats the original prompt.
ReWOO pays for one planner prompt (large), N small worker prompts (just the tool call, no chain), and one solver prompt. On HotpotQA the paper measures roughly 5x fewer tokens with +4 absolute accuracy.
Why it is more robust
If worker 3 fails in ReAct, the loop has to reason its way out of the error mid-stream. In ReWOO, worker 3 returns an error string, and the solver sees it next to the original plan and can degrade gracefully. Failure localization is per node, not per step.
Planner distillation
The paper's second result follows from the first. The planner never sees observations, so you can fine-tune a 7B model on planner outputs from a 175B teacher. The small model plans and the big model isn't needed at inference. This is standard practice now, and many 2026 production agents pair a small planner with a big executor, or the reverse.
Plan-and-Execute (LangChain, 2023)
The LangChain team's August 2023 post turned ReWOO into a named pattern: Plan-and-Execute. An up-front planner emits a step list, an executor runs each step, and an optional replanner can revise the plan after seeing results. Because the replanner pulls observations back into planning, this sits closer to ReAct than ReWOO does, but it keeps most of the token savings.
Plan-and-Act (Erdogan et al., arXiv:2503.09572, ICML 2025)
Plan-and-Act scales the pattern to long-horizon web and mobile agents. Its key contribution is synthetic plan data: a labeled trajectory generator produces training examples where the plan is explicit. That data fine-tunes planner models that keep working past 30-50 steps on WebArena-like tasks, where a single ReAct trajectory loses coherence.
When to pick which
| Pattern | When |
|---|---|
| ReAct | Short tasks, unknown environment, need reactive exception handling |
| ReWOO | Structured tasks with known tools, token-sensitive, parallelizable evidence |
| Plan-and-Execute | Like ReWOO but with replanning after partial execution |
| Plan-and-Act | Long-horizon (>30 steps), web/mobile/computer-use |
| Tree of Thoughts | Search is worth paying for (Lesson 04) |
Anthropic's Dec 2024 guidance is to start with the simplest thing that works. If the task is one tool call plus a summary, don't build ReWOO. If it's a 40-step research assignment, don't run ReAct alone.
Build It
code/main.py implements a toy ReWOO:
Planner: a scripted policy that emits a plan DAG from a prompt.Worker: dispatches each node's tool call through the registry.Solver: scripted composition that reads the evidence and produces a final answer.- Dependency resolution: references like
#E1get replaced with earlier worker outputs.
The demo answers "What is the population of the capital of France, rounded to millions?" with a two-step plan. Step one looks up the capital, step two looks up the population, then the solver composes the answer.
Run it:
python3 code/main.py
The trace prints the full plan first, then the worker results, then the solver's composition. It also prints a rough character count, so compare that against an interleaved ReAct run of the same task. ReWOO wins on structured work like this.
Use It
LangGraph ships Plan-and-Execute as a recipe: create_react_agent for ReAct, custom graphs for plan-execute. CrewAI's Flows encode the pattern directly. You define the tasks up front and the Flow DAG executes them. Plan-and-Act's synthetic-data approach is still mostly research, but its runtime pattern, an explicit plan DAG, already ships in production through LangGraph and CrewAI Flows.
Ship It
outputs/skill-rewoo-planner.md generates a ReWOO plan DAG from a user request and a tool catalog. Before handing off to an executor, it validates the plan: acyclic, every reference resolved, every tool present.
Most plan-and-execute failures come from the plan, not the executor. A planner that can't see observations will happily write step 3 against a tool output it has guessed wrong, and the DAG looks perfectly valid right up until a worker runs. Validate the plan hard (the Ship It skill does) and keep the tool catalog small enough that the planner can't invent a call. If you find yourself bolting on replanning after every step, you've rebuilt ReAct with extra prompts. At that point just use ReAct.
Exercises
- Parallelize worker execution for independent plan nodes. What does it buy you on a 6-node DAG with 2 parallel groups?
- Add a replanner node that fires if any worker returns an error. What is the smallest change that turns ReWOO into Plan-and-Execute?
- Replace
Plannerwith a small model (7B class) and keepSolveron a frontier model. Compare end-to-end quality. Where does the split fail? - Read Section 4 of the ReWOO paper on planner distillation and reproduce the 175B -> 7B result conceptually. What training data do you need, and how do you score plan quality?
- Port the toy to Plan-and-Act's trajectory shape, where the plan is a sequence instead of a DAG. What tradeoffs change?
Key Terms
| Term | What people say | What it actually means |
|---|---|---|
| ReWOO | "Reasoning without observations" | Plan, then fetch evidence in parallel, then solve. No observations appear in the planning prompt |
| Plan-and-Execute | "LangChain's plan-execute pattern" | ReWOO with an optional replanner node after execution |
| Plan-and-Act | "Scaled plan-execute" | Explicit planner/executor split with synthetic plan training data for long-horizon tasks |
| Evidence reference | "#E1, #E2, ..." | Plan-node placeholder substituted with prior worker output at dispatch time |
| Planner distillation | "Small planner, big executor" | Fine-tune a small model on planner traces from a large teacher |
| Token efficiency | "Fewer round trips" | 5x fewer tokens on HotpotQA vs ReAct in the paper |
| DAG executor | "Topological dispatcher" | Runs plan nodes in dependency order, parallel at each level |
Further Reading
- Xu et al., ReWOO: Decoupling Reasoning from Observations (arXiv:2305.18323): the canonical paper
- Erdogan et al., Plan-and-Act (arXiv:2503.09572): scaled planner-executor with synthetic plans
- LangGraph Plan-and-Execute tutorial: the framework recipe
- Anthropic, Building Effective Agents: pick the simplest pattern that works
Code
- main.py (python, 203 lines)