ReWOO
also known as Reasoning Without Observation, Plan-as-DAG, Placeholder-Variable Plan
Plan a complete dependency DAG with placeholder variables before any tool runs, then execute and substitute observations into the plan.
This pattern helps complete certain larger patterns —
- specialisesPlan-and-Execute★★— Plan all the steps once with a strong model, then execute each step with a cheaper model under the plan.
Context
A team runs a multi-tool agent on tasks where most of the planning could be done in one shot — search for X, then summarise the result, then extract a field — because each step's structure is determined by the task, not by what the previous step returned. A strong, expensive model is doing the planning and a cheap worker can do the tool calls. Token cost matters: the agent is called at volume.
Problem
In a ReAct loop (reason-act-observe), every tool observation is fed back into the planner's prompt for the next reasoning turn. Token cost therefore grows roughly with the square of the step count, because each turn carries the trace of all the previous turns. On an eight-step task the planner re-reads its own scratch reasoning and all prior observations seven times. Most of those re-reads do not change the plan — the structure was knowable up front — so the team is paying for re-prompting that produces no new decisions.
Forces
- Pre-planning fails when dependencies are truly observation-dependent.
- Placeholder substitution requires a typed variable convention.
- Plan correctness must be high; mid-run replans defeat the saving.
Example
A research agent built with ReAct burns tokens because each tool observation re-enters the prompt for the next reasoning turn; an eight-step task quadratic-blows. The team rewrites it as ReWOO: planner emits a DAG with placeholder variables (`t1 = Search(x); t2 = Summarise(#t1)`), a worker resolves the DAG, and a solver reads the final trace once. Total tokens drop sharply on multi-tool tasks while quality holds.
Diagram
Solution
Therefore:
Three roles. Planner emits a DAG with steps `t1 = ToolA(x); t2 = ToolB(#t1)` using variable references. Worker executes each tool in dependency order. Solver reads the resolved trace and produces the final answer. The planner never sees observations.
What this pattern forbids. The Planner cannot see tool outputs; substitution happens only at the Worker stage.
The smaller patterns that complete this one —
- generalisesLLMCompiler·— Take ReWOO's plan-as-DAG and run independent steps in parallel through a task-fetching dispatcher.
Neighbourhood
Click any neighbour to follow the language. Scroll to zoom, drag to pan.