ReAct ("Reasoning + Acting") is the seminal agentic prompting strategy introduced by Yao et al. (2022) in "ReAct: Synergizing Reasoning and Acting in Language Models". It instructs a large language model to alternate between three traces:
- Thought, a free-form natural-language reasoning step (a kind of localised chain-of-thought).
- Action, a structured tool invocation, e.g.
Search[Eiffel Tower height]. - Observation, the result returned by the environment, fed back into the prompt.
The loop continues until the model emits a terminal Action: Finish[answer].
Mechanism
Concretely the prompt template looks like:
Question: How tall is the Eiffel Tower in metres?
Thought 1: I should look this up.
Action 1: Search[Eiffel Tower height]
Observation 1: The Eiffel Tower is 330 m tall including antennas.
Thought 2: The question asks for height in metres; 330 m answers it.
Action 2: Finish[330 metres]
Each turn the agent's context grows by one (Thought, Action, Observation) triple. The model is conditioned on the entire trace plus a few-shot exemplar at the top of the prompt.
Why it works
- Reasoning without acting (pure chain-of-thought) hallucinates facts.
- Acting without reasoning (raw tool calls) cannot plan multi-step retrieval.
- Interleaving them lets the model decide what to look up next based on what it has already observed, a primitive form of dynamic programming over the search space.
On HotpotQA and Fever, ReAct outperformed both pure CoT and pure act-only baselines. On ALFWorld and WebShop it more than doubled the success rate of imitation-learning agents.
Modern relevance
ReAct is the template for almost every production agent loop today. Frameworks such as LangChain, LlamaIndex, and AutoGen all default to a ReAct-style scratch-pad. The pattern survived the move to native function calling: the JSON tool call replaces the Action: Tool[args] line, but the Thought/Observation cadence is identical.
Modern variants:
- ReWOO (Reasoning WithOut Observation), plan all tool calls up front, then execute.
- Plan-and-Solve, explicit
Planstep before the action loop. - ReAct + reflection, pair with Reflexion so the agent can critique its own trace and retry.
Citation
Yao, S. et al. (2022). ReAct: Synergizing Reasoning and Acting in Language Models. ICLR 2023. arXiv:2210.03629.
Related terms: Tool Use, Function Calling, Chain-of-Thought, Self-Reflection, Tree of Thoughts
Discussed in:
- Chapter 15: Modern AI, Agent Loops