Özer Cem KELAHMETKELAHMET
AI Simulations · Agents

ReWOO versus ReAct: how many tokens an agent saves by planning its tool calls up front

ReAct calls the model after every tool result and resends the prompt and history each time. ReWOO plans all the tool calls in one pass, runs them, and answers in a second pass. Change the prompt sizes, step lengths and prices and see where the tokens go.

Download Markdown

Interactive simulation. It needs JavaScript; the text below explains what it shows.

What you are looking at

Each row is a multi-hop question in the style of HotpotQA, such as "Which magazine was started first, Arthur's Magazine or First for Women?". The white columns say how many tool calls (searches) the question needs, how long the question is and how many tokens a search result has on average. The orange columns count the tokens two agent designs spend on the same calls: ReAct, which thinks and acts one step at a time, and ReWOO (Reasoning WithOut Observation), which plans every call first.

The chart shows tokens per question against the number of tool calls. The upper curve is ReAct with the average question and observation, and it bends upwards; the lower, straight line is ReWOO. The dots are the ReAct totals of the 20 questions. The bars show the tokens ReWOO saves on each one. For the ReAct loop itself, see the ReAct simulation and the ReAct loop page.

The algorithm

ReAct. For a question that needs k tool calls the model is called k + 1 times: k times to choose an action and once to answer. Every call is stateless, so it resends the instructions and examples (P_R), the question (q) and every earlier thought, action and observation. With a tokens of thought and action per step and o tokens per observation, the input is

I_ReAct = (k + 1)(P_R + q) + (a + o) · k(k + 1)/2

The first term repeats the prompt; the second grows with the square of the steps, as in the agent loop cost simulation.

ReWOO. The paper splits the agent into three modules. The Planner writes the whole plan in one call, as lines like "Plan: find the start year of Arthur's Magazine. #E1 = Wikipedia[Arthur's Magazine]", using variables such as #E1 for results it has not seen. Workers run the tools and substitute the variables, without a model call. The Solver reads the plan and the evidence and answers. With b tokens per plan line and prompts P_P and P_S:

I_ReWOO = (P_P + q) + (P_S + q + k(b + o))

Each observation is read once, and each prompt is sent once.

Worked example. With the defaults (ReAct prompt 1,800 tokens, planner prompt 1,200, solver prompt 300, a = 60, b = 45) question 1 has k = 2, q = 22 and o = 260. ReAct sends 3 × 1,822 + 320 × 3 = 6,426 input tokens and writes 3 × 60 + 20 = 200, 6,626 in all. ReWOO sends 1,222 + (322 + 2 × 305) = 2,154 and writes 2 × 45 + 20 = 110, 2,264 in all: 2.93 times fewer. Question 15 needs six searches: ReAct spends 21,097 tokens and ReWOO 4,002, 5.27 times fewer. Over the 20 questions ReAct averages 9,988 tokens and ReWOO 2,759, a token efficiency of 3.62 and 72.4% saved; 74.0% of ReAct's input is the same prompt sent again. At $3 and $15 per million tokens that is $33.08 against $10.14 per 1,000 questions. The ReWOO paper reports about 5 times better token efficiency on HotpotQA together with a 4% accuracy gain; real ReAct runs often take extra steps after failed searches, which this model leaves out.

Things to try

  • Shrink both the ReAct and planner prompts to 600 tokens. The efficiency falls to 2.40 and the saving to 58.4%: most of ReWOO's advantage is not resending a long prompt with examples.
  • Raise ReAct's thought and action to 150 tokens, as with verbose reasoning. ReAct rises to 10,942 tokens per question and the efficiency to 3.97.
  • Raise the solver prompt to 1,000 tokens. ReWOO costs 3,459 tokens and the efficiency drops to 2.89.
  • Change question 15 to 8 tool calls. Its ReAct cost jumps to 30,449 tokens against 4,802 for ReWOO, a ratio of 6.34: the longer the task, the bigger the gap.
  • Drop the input price to $0.3. ReAct costs $6.82 and ReWOO $3.11 per 1,000 questions: when input is cheap or cached, the saving in dollars shrinks.

How it works in real systems

The saving comes with a trade-off. ReWOO's planner commits to a plan before it sees any result, so it cannot react to a search that returns nothing or a surprise in the evidence. ReAct can. The ReWOO paper also notes robustness to tool failure and that the planner, because its training data does not depend on tool outputs, can be fine-tuned into a much smaller model: it offloaded the planning from GPT-3.5 (175B) to a 7B LLaMA model.

The LangGraph tutorial implements ReWOO as three nodes, planner, tool executor and solver, sharing a state with the task, the plan string, the parsed steps and the results. It lists two limits from the paper: with little context about the environment the planner uses tools badly, which few-shot examples or fine-tuning help, and the tasks still run one after another, so latency is the sum of every tool call. Running independent calls in parallel is the next step, see parallel tool calls.

In practice many agents sit between the two: plan-and-execute agents plan up front and re-plan after each step or when something fails, which gives back part of ReAct's flexibility for part of its cost. Prompt caching also changes the sums: if the repeated ReAct prefix is cached, its input is billed at a fraction of the price, see the prompt cache simulation. Count both tokens and accuracy on your own traces before choosing.

Sources

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