Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path →
ReAct,
explained.
A model that only reasons is a brilliant thinker locked in a windowless room — it can deduce beautifully but can't check a single fact against the world. This 2022 paper cut a door into that room: let the model think, step outside to look something up, come back with what it found, and think again. That simple loop is the blueprint for every AI agent.
What changes against chain of thought: the reasoning gets checked
Rung 1, and the comparison is against reasoning in a closed loop. A model reasoning step by step with no access to anything outside itself can reason fluently from a false premise — each step follows plausibly from the last, and nothing in the process can discover that the second step was wrong. The failure is confident and internally consistent, which is the worst combination.
The change is to interleave reasoning with actions that return results: a thought, then an action in the world, then the observation it produced, then the next thought conditioned on that observation. The loop runs both ways, and both directions matter. Reasoning makes the action better — the model decides what to look up rather than searching blindly. And the observation makes the reasoning better, because a claim that contradicts what just came back from a tool is corrected against something external rather than elaborated.
Stated in the units the ladder cares about: acting without reasoning gives a model no way to plan a sequence of lookups, and reasoning without acting gives it no way to be wrong about facts. The pattern is grounding — every few steps, the chain is anchored to something that was not generated. And it costs nothing to adopt, because like rung 1 of the reasoning ladder it is a prompting pattern rather than a model: no training, no parameters, no gradient.
Two ways to fail
By 2022 there were two ways to get more out of a language model, and each broke in its own way. Reasoning-only (chain-of-thought) let the model think in steps — but with no access to the outside world, it would reason its way to a confident, wrong answer, hallucinating facts it had no way to check.
Acting-only approaches let the model call tools — search, APIs — but with no reasoning between calls, it flailed: it couldn't plan a sequence of lookups, recover from a dead end, or decide what to do with what it found.
The big idea: do both, in turns
ReAct — short for Reasoning + Acting — simply interleaves them. The model is prompted to alternate between thinking about what to do and doing it, feeding each result back into the next thought. Reasoning decides the next action; the action's result grounds the next round of reasoning.
It's how a person actually researches something: think about what you need, look it up, read what you found, adjust your plan, look up the next thing. Not pure thought, not blind clicking — a conversation between the two.
The Thought–Action–Observation loop
Concretely, the model cycles through three moves until it can answer:
The observation isn't the model's guess — it's a real result from a real tool. That's the whole point: each loop injects a fact from outside the model's memory.
A sample trace
This trace is a condensed illustration, not a transcript from the paper (in the paper's own Apple Remote example the agent's search[Front Row] fails and it retries with Front Row (software)). No single fact was memorized. The model reasoned about what to fetch, fetched it, and let each observation steer the next step to the answer.
Why the two help each other
The magic is the synergy. Reasoning makes acting smarter — the model plans which tool to call and why, and recovers when a search comes back empty. Acting makes reasoning honest — every observation is a fact from the world, so the chain of thought can't quietly drift into fiction.
ReAct is essentially chain-of-thought that can reach out and check its work. That's why it hallucinates far less than reasoning alone: the loop keeps dragging the model back to reality.
The whole method is one repeated step, and the arrow that matters is the last one — the observation feeds the next thought:
Strip the Observations out and you have plain reasoning — which, on a multi-hop question, has nothing to look up. The runnable version below solves the Apple Remote question both ways.
Why it still matters
ReAct is the conceptual backbone of the entire agent era. Function calling, web-browsing assistants, coding agents, research agents — nearly all of them run some version of the Thought–Action–Observation loop this paper named. Frameworks like LangChain and the tool-calling APIs of every major model provider are, at heart, machinery for running ReAct loops.
It gave the field its simplest, most general recipe for turning a next-token predictor into something that can pursue a goal: let it think, let it act, and let what it observes shape what it thinks next.
When you design an agent, most of the hard engineering — tool schemas, observation formatting, loop termination, error recovery — is about running this loop reliably at scale. Understanding ReAct is understanding the shape of every agent you'll build.
How ReAct was run: prompts, actions, step budgets and fallbacks
ReAct is a prompting method, so the whole procedure lives in the prompt and in a small harness around a frozen model. The paper's main runs use PaLM-540B with greedy decoding.
- Write a handful of trajectories by hand. For HotpotQA the authors picked 6 training questions at random, and for FEVER 3, and wrote out a complete solution for each: every thought, every action and every observation the API returned. They report that more exemplars did not help. The prompt is those trajectories followed by the new question.
- Expose three actions and nothing else. The knowledge tasks talk to a deliberately simple Wikipedia API.
search[entity]returns the first five sentences of that entity's page, or the five most similar titles if no page matches.lookup[string]returns the next sentence on the current page that contains the string, like Ctrl+F.finish[answer]ends the episode. There is no calculator and no free-text search engine; the authors chose an interface weaker than real retrievers so the model has to reason about exactly which title to ask for. - Generate one step, then stop. The model writes
Thought n:andAction n:; the harness halts generation, executes the action, appendsObservation n:with the result and lets the model continue. A thought touches nothing outside the model and returns no observation. It only adds text that later steps condition on. - Recover by rewording. When a search misses, the observation lists similar titles and the next thought picks one. One of the hand-written HotpotQA exemplars shows the full pattern: search Colorado orogeny,
lookup[eastern sector]to jump to the sentence that matters, land on a disambiguation page for High Plains, search High Plains (United States), and finish with 1,800 to 7,000 ft. - Cap the steps, then fall back. ReAct gets 7 steps on HotpotQA and 5 on FEVER. Correct trajectories that needed that many steps were under 1.5 percent of the total, and more steps did not raise the score. Two back-off rules connect ReAct to self-consistency (CoT-SC: 21 chain-of-thought samples at temperature 0.7, majority vote). ReAct hands over to CoT-SC when it runs out of steps without calling
finish; CoT-SC hands over to ReAct when its top answer gets fewer than half the votes, a sign that the model's own knowledge is not settled. - Thin out thoughts for long tasks. In ALFWorld and WebShop an episode can run to dozens of actions, so thoughts are sparse and the model decides when to write one: to break the goal into subgoals, track progress, or guess where an object is likely to be. ALFWorld prompts use 2 of 3 annotated trajectories per task type, which gives 6 prompt variants; WebShop uses a single example.
- Optionally fine-tune on its own successes. The authors also kept 3,000 ReAct trajectories that reached the correct answer and fine-tuned PaLM-8B and PaLM-62B to generate whole trajectories, thoughts, actions and observations, from the question alone.
The prompt format
Every exemplar and every live episode has the same plain-text shape: Question:, then numbered Thought, Action and Observation lines, ending in finish[answer]. There is no tool schema and no special training. The action grammar is carried entirely by the exemplars, which is why the same recipe carried over from Wikipedia questions to a text household game and a shopping website by changing only the actions and the exemplars.
ReAct's augmented action space and back-off rules
ct— the context: every observation and action so far, which is exactly what the prompt holds.π— the policy; here a frozen PaLM-540B reading a few exemplars.A— actions that query or change the environment: search, lookup and finish on the knowledge tasks.L— the space of language. A thought is an action inL: free, unbounded and invisible to the environment.votes(y)— how many of thensampled chains end in answery.
At the extremes the equations recover the baselines. Remove every thought and  collapses to A, which is the Act baseline. Remove every action and only L remains, which is chain of thought. Set the vote threshold to zero and CoT-SC never hands over; set it above n and every question goes to search. The authors note the catch built into the second line: because L is unlimited, learning a policy over it needs strong language priors. Consistent with that, prompted ReAct was the weakest of the four methods at 8B and 62B and worked well only at 540B.
ReAct's scores on HotpotQA, FEVER, ALFWorld and WebShop
All prompting results use PaLM-540B. HotpotQA is scored by exact match and FEVER by accuracy. The baselines are ablations of the same exemplars: Standard (no thoughts, actions or observations), CoT (thoughts only), CoT-SC (21 sampled chains, majority vote) and Act (actions and observations, no thoughts).
| Prompt method | HotpotQA (EM) | FEVER (acc) |
|---|---|---|
| Standard | 28.7 | 57.1 |
| CoT | 29.4 | 56.3 |
| CoT-SC | 33.4 | 60.4 |
| Act | 25.7 | 58.9 |
| ReAct | 27.4 | 60.9 |
| CoT-SC → ReAct | 34.2 | 64.6 |
| ReAct → CoT-SC | 35.1 | 62.0 |
| Supervised state of the art | 67.5 | 89.5 |
ReAct alone trails both CoT and CoT-SC on HotpotQA and edges them on FEVER, where a claim can hinge on one detail that has to be looked up. The combinations are the best prompts on each task, and both reach CoT-SC's 21-sample score with only 3 to 5 samples.
A hand-labeled error analysis explains the HotpotQA gap: 50 correct and 50 incorrect trajectories from each method. Hallucination caused 56 percent of CoT's failures and none of ReAct's, and 14 percent of CoT's correct answers rested on hallucinated reasoning against 6 percent for ReAct. But 47 percent of ReAct's failures were reasoning errors, including loops that repeat earlier thoughts and actions, 23 percent were searches that returned nothing useful, and 29 percent were label ambiguity.
On the interactive tasks thoughts pay off. In ALFWorld (134 unseen games) the best of six ReAct prompts solved 71 percent, against 45 percent for the best Act prompt and 37 percent for BUTLER, an imitation learner trained on 100,000 expert trajectories per task type; even the worst ReAct prompt, at 48, beat both. A variant whose thoughts only narrated environment feedback, in the style of Inner Monologue, reached 53 at its best. On WebShop, ReAct's success rate was 40.0 against 28.7 for imitation plus reinforcement learning and 59.6 for human experts.
Fine-tuning reverses the small-model result: on 3,000 of its own correct trajectories, PaLM-8B ReAct beat every 62B prompting method and PaLM-62B ReAct beat every 540B prompting method.
What the authors admit, and what happened next
Being a prompting pattern is also the limitation. Reliability is entirely the underlying model's, and the characteristic failures were visible immediately: agents that loop, repeating the same search with the same query and the same result; agents that take an action whose observation they then ignore; agents that stop early. Nothing in the pattern prevents any of these, because the pattern is a suggestion about output format.
It is also memoryless across episodes. Whatever the agent works out is lost when the task ends, so the same mistake is available to be made again tomorrow. Rungs 3 to 6 are each an answer to that one sentence.
How it held up: this is the agent loop. Every framework, every tool-calling API, every deployed agent on this site runs thought, action, observation, repeat — sometimes with the labels hidden inside a structured tool-call interface, which is the same loop with better plumbing. Its adoption was so complete that the paper's contribution is easy to understate: before it, "language model uses a tool" and "language model reasons" were separate research directions, and the useful observation was that each one repairs the other's main weakness.
Run the reason-and-act loop
ReAct is a loop you can implement: think, call a tool, read the result, think again. This runs the paper's own Apple Remote question against a tiny searchable world — watch the agent chain two lookups, where the second query is built from the first observation, and land on the right answer. Then watch a reason-only agent, stripped of its tool, fail the same question because it has nothing to retrieve. The grounding is the whole difference.
Write the body of react_solve. Everything else in the file is
already written; this is the function the paper is about. Press ▶ Run to check it against
the 5 assertions below — they start red.
- The ReAct loop reaches the correct multi-hop answer
- It grounds the answer in at least two tool calls
- The trace starts Thought then Action then Observation
- A reason-only agent with no tool fails the question
- The second action is built from the first observation
Questions people ask about ReAct
What does a ReAct prompt template look like?
A ReAct prompt is a few complete solved examples followed by the new question. Each example is plain text: a question, then numbered Thought, Action and Observation lines, ending in a finish action that gives the answer. In the paper the actions were search[entity], lookup[string] and finish[answer] against a simple Wikipedia API. The authors wrote 6 such trajectories for HotpotQA and 3 for FEVER, picked at random from the training sets, and found that more did not help. At run time the harness stops generation after each Action line, executes it, pastes the result back as the next Observation and lets the model continue. For long household and shopping tasks the thoughts are sparse and the model decides when to write one.
Is ReAct better than chain-of-thought prompting?
Not uniformly. With PaLM-540B, ReAct scored 27.4 exact match on HotpotQA against 29.4 for chain of thought and 33.4 for self-consistency with 21 samples, but on FEVER it scored 60.9 against 56.3 and 60.4. The trade-off is grounding against flexibility: hallucination caused most chain-of-thought failures and none of ReAct's, while ReAct's rigid think, act, observe format produced more reasoning errors and depended on searches returning something useful. The best results came from combining them. Falling back from ReAct to self-consistency when ReAct runs out of steps gave 35.1 on HotpotQA, and falling back from self-consistency to ReAct when the vote is split gave 64.6 on FEVER.
Why do ReAct agents get stuck repeating the same search?
The paper names this as ReAct's characteristic failure. In a hand-labeled sample of HotpotQA trajectories, 47 percent of ReAct's failures were reasoning errors, a category that includes the model regenerating its previous thought and action and never breaking out of the loop. Another 23 percent came from searches that returned nothing useful, which derail the reasoning and are hard to recover from. The authors suspect greedy decoding contributes to the loops and suggest better decoding might help. The pattern itself offers no protection, because it only asks the model to alternate thinking and acting, so nothing stops it choosing the same action again. The step budgets, 7 actions on HotpotQA and 5 on FEVER, only cap the damage.
Which actions could the ReAct agent use on HotpotQA and FEVER?
Three, all against a simple Wikipedia API. search[entity] returns the first five sentences of the page for that entity, or suggests the five most similar titles if there is no exact page. lookup[string] returns the next sentence containing that string on the current page, like pressing Ctrl+F. finish[answer] ends the task with an answer. There was no calculator and no general search engine. The authors point out that this interface is much weaker than lexical or neural retrievers, and that the choice was deliberate: it forces the model to reason in language about which exact title to request, the way a person browsing Wikipedia would.
How does ReAct decide when to switch to self-consistency?
With two simple rules, tested in both directions. ReAct then CoT-SC: if ReAct has not called finish within its step budget, 7 steps on HotpotQA and 5 on FEVER, the question goes to chain-of-thought self-consistency, which samples 21 reasoning chains at temperature 0.7 and takes the majority answer. CoT-SC then ReAct: if the majority answer appears in fewer than half the samples, the model's internal knowledge is treated as unreliable and the question goes to ReAct with search. The first ordering was best on HotpotQA at 35.1 exact match and the second on FEVER at 64.6 accuracy, and both matched 21-sample self-consistency while using only 3 to 5 samples.
Does fine-tuning help ReAct more than prompting?
Yes, by a wide margin at small sizes. Prompted with a few examples, ReAct was the weakest of four methods at PaLM-8B and PaLM-62B, because learning both reasoning and acting from in-context examples is hard for small models. The authors then fine-tuned those models on 3,000 ReAct trajectories with correct answers, generated by the prompted large model. Fine-tuned PaLM-8B ReAct then beat every prompting method at 62B, and fine-tuned PaLM-62B ReAct beat every prompting method at 540B. Fine-tuning on standard or chain-of-thought outputs helped much less, which the authors attribute to those formats teaching the model to memorize facts rather than how to go and look them up.
4 questions to test what you just read
Work each one out before you open it — a number, a prediction or a reason, not a definition. Producing the answer is what makes it stick. Your progress is kept on this device.
CoT-SC samples 21 chains. How many votes must the top answer get to avoid handing the question to ReAct, and why is a split vote a good trigger for search?
Show answer
The rule hands over when the top answer occurs fewer than n/2 = 10.5 times, so it needs at least 11 of 21 votes. When samples scatter across answers, the model's internal knowledge is not settled, which is exactly when an outside lookup adds information; a confident majority is usually right without paying for search.
Hallucination caused 56 percent of chain-of-thought failures on HotpotQA and none of ReAct's, yet ReAct scored lower, 27.4 against 29.4. How can the more grounded method lose?
Show answer
Grounding removed one error type and introduced others. ReAct's failures were 47 percent reasoning errors, including repetitive loops, and 23 percent uninformative searches against an API that only returns exact-title pages. The fixed thought, action, observation structure is less flexible than free reasoning, so ReAct traded fabricated facts for getting stuck.
If you strip every Thought line out of the ALFWorld exemplars, which baseline do you get, and what did it cost?
Show answer
You get Act: the same trajectories with actions and observations only. Its best prompt solved 45 percent of the 134 games against 71 percent for ReAct's best. The authors saw Act fail to break goals into subgoals and lose track of the environment's state, which is the job the sparse thoughts were doing.
A ReAct episode on HotpotQA reaches step 7 without calling finish. Under the ReAct → CoT-SC rule, what happens next, and why was 7 a sensible budget?
Show answer
The question goes to CoT-SC: 21 sampled chains, majority answer. Seven was enough because only 0.84 percent of correct HotpotQA trajectories needed that many steps, and the authors found more steps did not improve ReAct, so a long episode is more likely stuck than close to an answer.
Agents that act
Give the model a tool, then a loop, then a memory, then a world. Ends on the 2026 paper measuring how badly the whole stack degrades over many turns.
Explore the topic
See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.
More Paper Breakdowns
- MemGPTAn operating system for LLM memory. Context window as RAM, external storage as disk, and the model as its own memory manager — paging facts in and out with function calls, revising core memories when facts change, and summarizing under memory pressure. The architecture behind modern agent memory (and Letta).Read →
- ReflexionAgents that learn from their own mistakes — reinforcement through words instead of weights. Fail, write a verbal reflection on why, store it in episodic memory, retry with the lesson in context. Actor + Evaluator + Reflector took GPT-4 from 80% to 91% on HumanEval, and the pattern now lives inside every self-correcting agent.Read →
- VoyagerThe Minecraft agent that never stops learning. An automatic curriculum picks the next just-hard-enough goal, the agent writes code to achieve it, debugs against environment feedback, and saves every verified program to a compounding skill library. 3.3× more items, 15.3× faster tech tree — and the blueprint for agents that build their own tools.Read →
- Generative AgentsThe Smallville paper: 25 LLM characters living in a simulated town. A memory stream retrieved by recency × importance × relevance, reflection trees that turn events into beliefs, and plans that bend to interruptions — producing a Valentine's party that organized itself. The memory architecture behind modern persistent agents.Read →
- LLMs Get Lost in Multi-Turn ConversationThe ICLR 2026 Outstanding Paper that measured a failure everyone had felt: give a top model a fully-specified task in ONE prompt (concat) and it shines; split the IDENTICAL requirements across several turns (sharded) and 15 leading LLMs fall apart — ~39% average drop. The decomposition is the punchline: APTITUDE (best-case ability) barely moves, but RELIABILITY craters — the spread between a model's best and worst runs roughly DOUBLES. The mechanism is premature commitment: handed partial info, the model guesses a full answer early, locks it in, and when a later turn contradicts it "gets lost and does not recover." A small decay model captures the shape — concat R=p (flat), sharded R=p·(1−q)^(turns−1) (geometric decay), so longer chats get less reliable and the whole loss lives in a reliability term while the ceiling p is untouched. Fixes: front-load the spec, or consolidate/recap a long chat back into one fresh full-spec message. Worked math plus runnable code.Read →
- Kimi K2A trillion parameters built for agents. A 1T-param open MoE (32B active) trained through 15.5T tokens with ZERO loss spikes via MuonClip (Muon + QK-clip), plus large-scale synthesis of tool-use episodes so agentic behavior is pretrained, not bolted on. The moment open weights led on agent workloads.Read →