Özer Cem KELAHMETKELAHMET
Articles · ReWOO

ReWOO explained: plan every tool call up front and cut agent tokens, step by step

ReWOO, reasoning without observation, writes the whole tool plan before any tool runs, then fills in the evidence and answers in one more call. This guide explains the planner, worker and solver from the paper, runs the pattern in Python, and works out when it beats ReAct on tokens and when it fails.

Download Markdown
At a glance
Reading time
13 min
Sections
8
Code examples
3
Tables
3
Sources
7
Published
24 Nov 2026
In 30 seconds
What changed
The ReWOO paper is posted on arXiv
Why it matters
Use ReWOO for predictable pipelines.
What to do
Find your predictable flows

A ReAct agent calls the model after every tool result. Each call re-sends the instructions, the examples and the whole history so far. For a question that needs four lookups, the model reads the same few thousand tokens of prompt four or five times. ReWOO, short for "Reasoning WithOut Observation", removes most of that repetition. The model writes the complete plan once, with placeholders for results it has not seen yet, a worker runs the tools and fills in the placeholders, and a final call writes the answer.

The 2023 paper behind it reported 5x token efficiency and a 4% accuracy improvement on the HotpotQA multi-hop benchmark, and showed the planning skill could be moved from a 175-billion-parameter GPT-3.5 model into a 7-billion-parameter LLaMA model. Those claims, and the pattern's blind spot (it cannot change course when a tool surprises it), make ReWOO a useful tool to understand next to ReAct and plan-and-execute.

What happened

The ReWOO paper is posted on arXiv (May 2023)

Binfeng Xu, Zhiyuan Peng, Bowen Lei, Subhabrata Mukherjee, Yuchen Liu and Dongkuan Xu published "ReWOO: Decoupling Reasoning from Observations for Efficient Augmented Language Models". They argued that interleaving reasoning and tool output, as ReAct, Reflexion and AutoGPT-style agents do, causes "huge computation complexity from redundant prompts and repeated execution", and proposed a modular alternative.

The authors release code, a 7B planner and a dataset

The repository billxbf/ReWOO supports direct, cot, react and rewoo methods across HotpotQA, TriviaQA, GSM8K, a physics question set, sports understanding, StrategyQA and a curated question set over the 2023 State of the Union address. The team also uploaded an instruction-tuned planner based on Alpaca 7B and a 2,000-example planning dataset built from correct HotpotQA and TriviaQA trajectories.

The pattern moves into frameworks

The README points to Gentopia, the authors' agent framework, as the "official (and better)" implementation, and LangChain's LangGraph examples included a ReWOO notebook, now archived in the repository. The pattern also shaped later planners such as LLMCompiler, which adds parallel execution of independent steps.

How ReWOO works, step by step

Think of a lawyer who sends a paralegal to the archive. A slow lawyer asks for one file, reads it, asks for the next, reads it, and so on, walking back and forth all day. A good lawyer writes the full request list at once: "File 1: the 2019 contract. File 2: every invoice referenced in file 1. File 3: the emails about the largest of those invoices." The paralegal fetches everything, and the lawyer reads it all in one sitting. ReWOO makes the model behave like the second lawyer.

It splits the agent into three modules.

  1. Planner. One LLM call. Given the question and a few examples, it writes a list of steps. Each step is a short "Plan:" sentence followed by an evidence variable and a tool call, such as #E2 = Search[capital of #E1]. Later steps can refer to earlier evidence variables before their values exist.
  2. Worker. No LLM reasoning. It runs the tool calls in order, replacing each #En placeholder with the actual result of step n.
  3. Solver. One LLM call. It reads the plans and the collected evidence and writes the final answer.

The key idea is "foreseeable reasoning". For many multi-hop questions, the model can predict the shape of the work without seeing intermediate results: find X, then use X to find Y. It does not need to see that X is "Brazil" to know that the next step is "capital of X".

A runnable ReWOO pipeline

This version uses a scripted planner and solver output and a toy search tool with hard-coded facts, so it runs without an API key. The parsing, substitution and solver prompt are the parts you keep.

import re

PLAN = """Plan: Find which country hosted the 2016 Summer Olympics.
#E1 = Search[2016 Summer Olympics host country]
Plan: Find the capital of that country.
#E2 = Search[capital of #E1]
Plan: Find the population of that capital.
#E3 = Search[population of #E2]"""          # what the planner LLM writes in ONE call

FACTS = {   # toy tool data
    "2016 Summer Olympics host country": "Brazil",
    "capital of Brazil": "Brasilia",
    "population of Brasilia": "about 2.8 million (2022 census)",
}
TOOLS = {"Search": lambda q: FACTS.get(q, "no result")}

def parse_plan(plan):
    return re.findall(r"Plan: (.*)\n(#E\d+) = (\w+)\[(.*)\]", plan)

def work(steps):                               # no LLM calls in here
    evidence = {}
    for _, var, tool, arg in steps:
        for k, v in evidence.items():
            arg = arg.replace(k, v)            # fill earlier results into placeholders
        evidence[var] = TOOLS[tool](arg)
        print(f"{var} = {tool}[{arg}] -> {evidence[var]}")
    return evidence

def solver_prompt(question, steps, evidence):
    prompt = "Solve the task using the plans and evidence.\n"
    for plan, var, _, _ in steps:
        prompt += f"Plan: {plan}\nEvidence: {evidence[var]}\n"
    return prompt + f"Task: {question}\nResponse:"

steps = parse_plan(PLAN)
evidence = work(steps)
print(solver_prompt("What is the population of the capital of the 2016 Olympics host?", steps, evidence))

The worker prints the resolved chain:

#E1 = Search[2016 Summer Olympics host country] -> Brazil
#E2 = Search[capital of Brazil] -> Brasilia
#E3 = Search[population of Brasilia] -> about 2.8 million (2022 census)

Three tool calls, two LLM calls in total. A ReAct agent would need four LLM calls for the same work: one before each tool call and one to finish.

In production, keep one rule from this code: substitute placeholders in the worker, not by asking the model. And keep one improvement: replace a single #E1 string with a regular expression that matches whole variables, otherwise #E1 also matches the start of #E10.

Writing the planner prompt

The planner prompt does most of the work, so it deserves care. A good one has four parts. First, a list of tools with one line each on what they return, because the planner cannot learn from observations what a tool does. Second, the exact output format: alternating "Plan:" and #En = Tool[input] lines, nothing else. Third, two or three worked plans for typical questions, including one where a later step uses an earlier variable. Fourth, a short rule that the last evidence variable should contain what the solver needs. The paper's own prompts follow this shape, and the planner's fixed format is what made it easy to fine-tune a small model on correct plans. Validate every plan before execution: unknown tools, references to variables that do not exist yet and more steps than your cap should all be rejected and re-planned, not run.

Where the token savings come from

The savings come from not re-reading the prompt. Take a concrete case. The system prompt with tool descriptions and few-shot examples is 1,500 tokens. Each ReAct step adds about 150 tokens of thought, call and observation. The question needs three tool calls.

Table 1. Where the token savings come from
ReAct ReWOO
LLM calls 4 (three actions, one finish) 2 (planner, solver)
Input tokens, call 1 1,500 1,500 (planner prompt)
Input tokens, call 2 1,650 about 900 (solver instructions, plans and 3 pieces of evidence)
Input tokens, call 3 1,800 none
Input tokens, call 4 1,950 none
Total input tokens 6,900 about 2,400

In this example ReWOO reads about 2.9 times fewer input tokens. The gap grows with longer few-shot prompts and more steps, because ReAct pays for the full prompt on every step while ReWOO pays for it once. The paper's 5x figure on HotpotQA reflects its own prompts and trajectories; your ratio depends on prompt length and steps. The agent loop token cost simulation lets you see how quickly the ReAct side grows.

ReWOO also helps latency, though less than tokens. Tool calls still run in sequence when they depend on each other, but you remove the model's think time between them. If steps are independent, you can run them in parallel, which is what LLMCompiler adds; the parallel tool calls simulation shows the effect on the critical path.

What the paper measured

The paper evaluated ReWOO on six public NLP benchmarks and the curated State of the Union dataset, against direct prompting, chain of thought and ReAct.

Table 2. What the paper measured
Claim in the paper and repository What it means
5x token efficiency on HotpotQA Roughly a fifth of the tokens ReAct used on the same task
4% accuracy improvement on HotpotQA Fewer tokens did not cost accuracy; it rose slightly
Consistent improvements across the benchmarks Not limited to one dataset
More robust under tool failure A broken tool hurts ReWOO less than ReAct, which can derail into loops
Planning offloaded from 175B GPT-3.5 to 7B LLaMA The planner can be fine-tuned into a small model

The last point is easy to overlook. Because the planner never sees observations, its job is a clean text-to-plan mapping. That makes it a good target for fine-tuning: the authors trained a 7B planner on about 2,000 correct planning trajectories. A small planner plus a larger solver, or even a small solver, can cut cost far more than token savings alone.

ReWOO next to ReAct and plan-and-execute

Table 3. ReWOO next to ReAct and plan-and-execute
Property ReAct ReWOO Plan-and-execute
When does the model plan? One step at a time Once, fully, before tools run Once, then re-plans after steps
Sees tool results before choosing the next call? Yes No Yes, at re-plan points
LLM calls for n tool steps n + 1 2 Usually 2 plus re-plans
Handles surprises in tool output Well Poorly Moderately
Best for Exploratory tasks Predictable multi-hop lookups Longer tasks with checkpoints

The trade-off is adaptivity. If #E1 comes back empty or ambiguous, ReWOO's worker still runs #E2 with a useless argument, and only the solver notices. ReAct would notice right away and try another search. Plan-and-execute sits in between: it plans ahead but re-plans after steps. The agentic patterns simulation shows the three side by side, and the plan-and-execute page covers the re-planning variant.

What it means in practice

Use ReWOO for predictable pipelines. Multi-hop lookups, report generation from known sources, and data enrichment where each step's purpose is clear in advance all fit well.

Avoid it for exploration. Debugging, open web research and anything where the next step depends on what you find are better served by ReAct or a planner that can re-plan.

Add a validity check between worker and solver. If any evidence is empty, an error or "no result", fall back to ReAct for the rest of the task instead of handing junk to the solver. This keeps most of the savings while covering the main failure mode.

Plans are a security boundary. Because the plan is written before any untrusted content is read, tool outputs cannot steer which tools run next. That is a useful property against indirect prompt injection, though the solver still reads untrusted evidence. See prompt injection defence.

What to do now

  1. Find your predictable flows. Look in traces for tasks where the sequence of tools is almost always the same; those are ReWOO candidates.
  2. Write a strict plan format. Use one "Plan:" line and one #En = Tool[args] line per step, and validate it with a parser before running anything.
  3. Resolve placeholders in code. Match whole variable names with a regular expression and never let the model do substitution.
  4. Check evidence before solving. Treat empty or error results as a trigger to re-plan or fall back to a ReAct loop.
  5. Run independent steps in parallel. If two steps do not reference each other's variables, execute them concurrently.
  6. Measure tokens per task. Compare total input and output tokens against your ReAct baseline on the same questions, as the paper did.
  7. Consider a small planner. Once you have a few thousand good plans in logs, fine-tune a small model to write them, as the authors did with a 7B model.
  8. Keep traces of plan and evidence. Log the plan, every resolved call and the solver prompt so failures can be traced to the planner, a tool or the solver; tracing tools make this routine.

Risks and open questions

Blind plans fail on surprises. If an early tool returns something unexpected, every later step can be wrong. The solver may then answer confidently from bad evidence.

Plans can be over-long. A planner may add steps "just in case". Without a cap, ReWOO can call more tools than ReAct would.

Old benchmarks, old models. The reported results used GPT-3.5-era models and benchmarks like HotpotQA. Native tool calling, parallel calls and prompt caching have since narrowed the token gap; measure on your own stack.

Error attribution needs care. With three modules, a wrong answer can come from the plan, a tool or the solver. Evaluate each module, not only the final answer.

Watch next: hybrid agents that plan ReWOO-style and fall back to ReAct on surprises, small fine-tuned planners in production, and how prompt caching changes the token arithmetic.

Frequently asked questions

What does "reasoning without observation" mean?

The planner reasons about the whole task without seeing any tool output. It writes placeholders such as #E1 for results that do not exist yet, and a worker fills them in later.

How many LLM calls does ReWOO use?

Two: one for the planner and one for the solver, regardless of how many tool calls the plan contains. Tools that are themselves LLM calls add to that.

Is ReWOO always cheaper than ReAct?

It reads far fewer tokens when the plan is right. If a plan fails and you fall back to ReAct, you pay for both, so savings depend on how predictable your tasks are.

Can ReWOO run tool calls in parallel?

The original worker runs them in order. Steps that do not depend on each other can be run concurrently, which is the main idea of LLMCompiler.

Does ReWOO protect against prompt injection?

Partly. The tool sequence is fixed before untrusted content is read, so a malicious tool result cannot add new tool calls. The solver still reads that content, so the final answer can still be manipulated.

Summary

ReWOO splits an agent into a planner that writes every tool call up front with evidence placeholders, a worker that executes the calls without the model, and a solver that answers from the collected evidence. It uses two LLM calls however many tools run, which is why the paper reported 5x token efficiency and a 4% accuracy gain on HotpotQA, plus robustness to tool failures and a planner small enough to fine-tune into a 7B model. Its weakness is that it cannot react to surprising tool results. Use it for predictable multi-hop work, check evidence before solving, and fall back to ReAct when a plan breaks.

Sources

Cite this article

Kelahmet, Ö. C. (2026, November 24). ReWOO explained: plan every tool call up front and cut agent tokens, step by step. Özer Cem KELAHMET. https://www.ozercemkelahmet.com/articles/rewoo-plan-once-agents-fewer-tokens

BibTeX
@online{kelahmet2026rewoo,
  author = {Kelahmet, {\"O}zer Cem},
  title  = {{ReWOO explained: plan every tool call up front and cut agent tokens, step by step}},
  year   = {2026},
  month  = {nov},
  url    = {https://www.ozercemkelahmet.com/articles/rewoo-plan-once-agents-fewer-tokens}
}
Version historyfirst version
  1. Published

Factual corrections are listed here with what changed. Wording and formatting edits are not listed.

Last updated Nov 24, 2026
Type to search.
    ↑↓ navigate↵ open