ReAct RAG: Reasoning and Acting with Retrieval
The ReAct loop applied to RAG — the model reasons, retrieves as an action, observes, repeats.
ReAct RAG applies the Yao et al. (2022; arXiv:2210.03629) ReAct loop to retrieval-augmented generation: the model emits a Thought, takes an Action (often a retriever or query-engine call), reads the Observation, and repeats until it finishes. Project page and code pointers ship at react-lm.github.io. This page covers the loop, how retrieval becomes a tool, the published scores, and the iteration budget one-shot RAG does not pay.
How does the ReAct Thought–Action–Observation loop work?
ReAct interleaves verbal reasoning with environment actions so the model can plan and gather information in the same trajectory (Yao et al., 2022, §2). The three labels practitioners see in prompts are:
- Thought — a free-form reasoning trace that updates the model’s working context. A Thought does not change the external environment; it decomposes goals, extracts from prior observations, or decides what to do next (Yao et al., 2022, §2).
- Action — a domain-specific call. In the paper’s Wikipedia QA setup the actions are search[entity], lookup[string], and finish[answer] (Yao et al., 2022, §3.1). In RAG frameworks the Action is usually a tool-wrapped retriever.
- Observation — the environment or tool return that the next Thought must condition on (search snippets, retrieved chunks, API payloads).
For knowledge-intensive QA the paper uses dense Thought–Action–Observation steps; for long decision trajectories it allows sparse Thoughts where the model decides when reasoning is needed (Yao et al., 2022, §2; Google Research ReAct blog, 2022).
How does ReAct use retrieval as an action in RAG?
ReAct becomes ReAct RAG when at least one Action is retrieval against your corpus. LlamaIndex’s “ReAct Agent with Query Engine (RAG) Tools” example (docs captured 2026-07-28) wraps indexes as tools the agent can call; LangChain’s create_react_agent pattern with a retriever tool does the same for multi-hop questions over internal documents (Sher, Towards Data Science). AWS Prescriptive Guidance pairs RAG grounding with ReAct-style prompting for chat assistants that must decide when to fetch more context. The Observation is then retrieved passages — not a fixed top-k prepended once as in Naive RAG. Broader control-loop designs beyond this Thought–Action pattern sit on Agentic RAG.
What results did the ReAct paper publish?
The figures below are PaLM-540B few-shot prompting results from the Google Research ReAct blog (and matching paper tables) — Wikipedia-API interaction on HotpotQA/FEVER, not a private vector-index SLA.
- HotpotQA (exact match, 6-shot). Standard 28.7, CoT 29.4, Act-only 25.7, ReAct 27.4, best ReAct+CoT combination 35.1 (supervised SoTA 67.5 with ~140k samples) — Google Research ReAct blog table.
- FEVER (accuracy, 3-shot). Standard 57.1, CoT 56.3, Act-only 58.9, ReAct 60.9, best ReAct+CoT 64.6 — same blog table. The paper argues ReAct trajectories are more fact-grounded than CoT alone, which can hallucinate mid-trace (Yao et al., 2022, abstract and §3.3).
- Interactive decision tasks. On ALFWorld and WebShop, ReAct with one or two in-context examples outperforms imitation/RL methods trained on roughly 103–105 instances by absolute success-rate gains of 34 and 10 percentage points respectively (Yao et al., 2022, abstract). Blog table: ALFWorld 2-shot ReAct 71 vs Act-only 45; WebShop 1-shot ReAct 40 vs Act-only 30.1.
Read those numbers as paper-setup evidence. End-to-end RAG quality on your corpus still needs your own eval — see RAG benchmarks.
What does ReAct cost per iteration?
ReAct’s cost is structural: every Thought–Action cycle is another language-model generation, and every Action may be a retrieval or API call. Yao et al. (2022, §3.2) stop and back off when ReAct has not finished within 7 steps on HotpotQA or 5 steps on FEVER. LangChain agent examples commonly set max_iterations (the Towards Data Science walkthrough uses 5) so a stuck agent cannot loop forever. Dollars per query on a private index are not published — measure latency and tool-call count on your stack. Pipeline-level spend framing is at pipeline cost.
When should you use ReAct RAG, and when should you avoid it?
ReAct RAG earns its multi-step overhead when the next retrieval depends on intermediate reasoning. It is the wrong default when one retrieve-then-generate pass already returns the needed passages.
- Use ReAct when tool choice is part of the answer. Multi-hop questions over internal documents where one-shot RAG fails composition — the failure mode the LangChain ReAct walkthrough starts from (Sher, Towards Data Science).
- Avoid ReAct for single-hop lookups. If Naive RAG already grounds the answer, the extra Thought/Action turns add latency without changing the evidence set.
- Expect prompt and loop failure modes. GeeksforGeeks’ ReAct prompting notes list prompt sensitivity and imperfect action choices among limitations; the paper itself flags limited reasoning/acting coverage under pure prompting and explores fine-tuning smaller PaLM models on successful trajectories (Yao et al., 2022, §1 contributions and §3.2).
If the symptom is hop-miss versus composition-miss rather than “needs an agent,” start at multi-hop failure diagnosis.
How does ReAct differ from IRCoT and agentic RAG?
ReAct is a general Thought–Action–Observation controller: Actions can be search, calculators, browsers, or retrievers. IRCoT is narrower — it interleaves CoT sentences as retrieval queries inside a retrieve-and-read loop (Trivedi et al., 2023). Agentic RAG is the broader family of retrieval control loops (planning, multiple tools, reflection); ReAct is one widely implemented pattern inside that family — see Agentic RAG. Multi-hop names the question type and iterative retrieve-and-compose problem; ReAct is one agent formulation of that problem on multi-hop RAG.
How do you implement ReAct RAG?
Implementation is a handoff checklist: expose retrieval as a tool, prompt the Thought/Action/Observation format, and cap iterations so the loop terminates.
- Wrap the retriever as a tool. LlamaIndex query-engine tools or a LangChain retriever tool are the usual RAG Actions.
- Prompt the ReAct format. Thought → Action → Action Input → Observation → … → Final Answer, matching framework defaults or the paper’s Wikipedia action grammar.
- Cap the loop. Set max_iterations (or the paper’s step ceilings) and handle parse errors so a bad Action string cannot spin.
- Keep runnable builds elsewhere. End-to-end wiring belongs at building a RAG pipeline; LangChain-specific stack notes at LangChain.
What is ReAct RAG?
ReAct RAG applies Yao et al. (2022; arXiv:2210.03629) Thought–Action–Observation prompting to retrieval: the model reasons, calls a retriever or query-engine tool as an Action, reads the Observation, and repeats until it finishes. Project page: react-lm.github.io.
How does Thought–Action–Observation work?
A Thought is verbal reasoning that does not change the environment. An Action calls a tool or API (search, lookup, finish in the paper; a retriever in RAG). An Observation is the tool return that conditions the next Thought (Yao et al., 2022, §2).
Is ReAct better than chain-of-thought?
Not always on HotpotQA exact match: PaLM-540B 6-shot ReAct scored 27.4 EM versus CoT 29.4, while the best ReAct+CoT combination reached 35.1 (Google Research ReAct blog). ReAct’s claim is grounded tool use and interpretable trajectories, not automatic EM dominance over CoT.
When is one-shot RAG enough instead of ReAct?
Use one-shot retrieve-then-generate when the first retrieval already contains the evidence. ReAct’s multi-step overhead is for cases where the next retrieval or tool call depends on intermediate reasoning.
How is ReAct different from IRCoT?
ReAct is a general Thought–Action–Observation controller with arbitrary tools. IRCoT specifically uses CoT sentences as retrieval queries in a retrieve-and-read loop. See /architectures/ircot/ for the CoT-query mechanism.