Lesson 47.2 · 2 of 5 · 4 min read · Reviewed 24 Nov 2026
ReWOO: planning without observations
By the end, you can
- Explain ReWOO.
- Know where it saves tokens and where it's risky.
The idea
Planner writes:
#E1 = search("population of Lisbon 2025")
#E2 = search("population of Porto 2025")
#E3 = calculator("#E1 / #E2")
Worker runs the three calls, filling #E1, #E2, #E3.
Solver: "Using these results, answer: how many times bigger is Lisbon than Porto?"
The planner never sees the observations. It reasons about the whole job at once, with variables standing in for results.
Why bother
In ReActReAct: An agent pattern that interleaves reasoning steps and actions (tool calls), using each observation to plan the next step., every step re-sends the whole growing history. For a 10-step task that’s a lot of repeated tokensToken: The unit a model reads and writes: a word, part of a word, a space or a symbol, mapped to an integer id.. ReWOO uses about three model calls (plan, solve, maybe a check), however many tools run.
When it fits
| Fits | Doesn’t fit |
|---|---|
| Lookups whose steps are known in advance | Debugging, where each finding changes the next step |
| Fan-out: fetch 10 things, then combine | Tasks where a failed step needs a different approach |
| Cost-sensitive, high-volume pipelines | Open-ended research |
With Claude
You can get much of the benefit with parallel tool callsParallel tool use: The model requesting several tool calls in one turn, which your code can run concurrently. (33.3): Claude asks for several independent calls in one turn, you run them together and return all the results. That’s ReWOO-like fan-out inside an ordinary tool loop.
Key points
- ReWOO (Reasoning WithOut Observation) plans every tool call up front, using placeholders for results it hasn't seen.
- A worker runs all the calls, then a solver writes the answer from the plan plus the results.
- It saves tokens because the model isn't re-prompted with growing history after each call.
- It can't react to surprises mid-run, so it suits predictable, lookup-style tasks.
Run a ReWOO plan with placeholders
Execute a plan whose later calls use placeholders for results not yet seen, then compare token use with ReAct.
You will have: A ReWOO worker and solver plus a printed token comparison.
Steps
- Run the starter: E2 and E3 receive the literal text #E1.
- Write substitute() to swap each #E placeholder for the stored evidence.
- Run it and check E2 and E3 now use Lisbon.
- Print the illustrative ReAct and ReWOO token totals and their ratio.
- Add a fourth planned call and see the gap widen.
Done when
- E2 and E3 show Lisbon, not #E1.
- The answer is built once from all the evidence.
- ReWOO uses about half the input tokens of ReAct for 3 calls.
Open in the Playground No API key needed.
Starter code (Python)
# ReWOO: plan every call up front with placeholders, run them all, then solve once.
import re
PLAN = [
("E1", "find_city", {"office": "Lisbon office"}),
("E2", "get_weather", {"city": "#E1"}),
("E3", "get_timezone", {"city": "#E1"}),
]
TOOLS = {
"find_city": lambda office: office.split()[0],
"get_weather": lambda city: f"18C and sunny in {city}",
"get_timezone": lambda city: f"{city} is on WET",
}
def substitute(args, evidence):
# TODO: replace any "#E<n>" value with evidence["E<n>"]
return args
def worker(plan):
evidence = {}
for eid, tool, args in plan:
real = substitute(args, evidence)
evidence[eid] = TOOLS[tool](**real)
print(f"{eid} = {tool}({real}) -> {evidence[eid]}")
return evidence
def solver(evidence):
return f"Answer: {evidence['E2']}; {evidence['E3']}."
ev = worker(PLAN)
print(solver(ev))
# Input tokens, illustrative: prompt 2,000 and each observation adds 500.
calls = len(PLAN)
react = sum(2000 + 500 * k for k in range(calls + 1)) # the model is called after every observation
rewoo = 2000 + (2000 + 500 * calls) # planner once, solver once
# TODO: print both totals and the ratio
Show a solution
# ReWOO: plan every call up front with placeholders, run them all, then solve once.
import re
PLAN = [
("E1", "find_city", {"office": "Lisbon office"}),
("E2", "get_weather", {"city": "#E1"}),
("E3", "get_timezone", {"city": "#E1"}),
]
TOOLS = {
"find_city": lambda office: office.split()[0],
"get_weather": lambda city: f"18C and sunny in {city}",
"get_timezone": lambda city: f"{city} is on WET",
}
def substitute(args, evidence):
return {k: (evidence[v[1:]] if isinstance(v, str) and re.fullmatch(r"#E\d+", v) else v) for k, v in args.items()}
def worker(plan):
evidence = {}
for eid, tool, args in plan:
real = substitute(args, evidence)
evidence[eid] = TOOLS[tool](**real)
print(f"{eid} = {tool}({real}) -> {evidence[eid]}")
return evidence
def solver(evidence):
return f"Answer: {evidence['E2']}; {evidence['E3']}."
ev = worker(PLAN)
print(solver(ev))
# Input tokens, illustrative: prompt 2,000 and each observation adds 500.
calls = len(PLAN)
react = sum(2000 + 500 * k for k in range(calls + 1)) # the model is called after every observation
rewoo = 2000 + (2000 + 500 * calls) # planner once, solver once
print(f"ReAct ~{react} tokens, ReWOO ~{rewoo} tokens, ratio {react / rewoo:.1f}x")