AIM-06-005-P · Primer — ReAct — Reasoning + Acting
The idea in one sentence
ReAct is a prompting pattern where a model alternates a reasoning thought, a tool‑calling action, and the observation of that action, looping until it can answer.
Why it exists
It works like a detective who first forms a hypothesis, then checks the evidence, and revises the hypothesis based on what they find; without the evidence the detective may chase false leads, and without a hypothesis the evidence collection is aimless. Pure reasoning often hallucinates facts, while pure acting lacks strategic direction. By interleaving the two, the agent can plan a step, verify reality, and adjust, dramatically cutting hallucination and handling multi‑step tasks.
How it works
- The model receives a user query and generates a Thought that explains the next logical step. 2. It follows the Thought with an Action, invoking a tool such as a web search or calculator. 3. The tool returns an Observation, which the model records. 4. Using the Observation, the model produces a new Thought that interprets the result and decides the next move. 5. Steps 2‑4 repeat until the model emits a final Answer. For example, asked "Who is older, X or Y?" the model thinks it needs birth years, searches X (Observation: 1980), thinks it now needs Y, searches Y (Observation: 1975), thinks Y is older, and answers Y. This loop was introduced by Yao et al. (2022) and combines chain‑of‑thought reasoning with grounded tool use.
A common variation replaces the explicit Thought‑Action‑Observation tags with a single "plan‑execute‑observe" loop, or integrates memory so past observations inform future thoughts. Another related framework is the "Toolformer" approach, which learns when to invoke tools without a fixed prompt structure.
See it — thought, action, observation
flowchart LR A["Thought:<br/>what should I do?"] --> B["Action:<br/>call a tool"] B --> C["Observation:<br/>tool result"] C --> A
The one gotcha
Many assume ReAct guarantees correct answers because observations are factual; in reality the model can still misinterpret observations or call the wrong tool, so the pattern only reduces but does not eliminate errors.
The one-line takeaway
ReAct lets AI reason like a human, checking its own ideas against real data step by step.
Where you'll meet it
Practitioners see ReAct in agents built on LLM APIs that support tool calls, such as OpenAI function calling or LangChain agents, and in audit logs that show alternating Thought, Action, Observation entries for each request.
