What is ReAct?
ReAct (Reasoning + Acting) is a prompting and agent-design pattern introduced in the paper "ReAct: Synergizing Reasoning and Acting in Language Models" (Yao et al., 2022).
The core idea is to interleave two phases in a loop:
| Phase | What happens |
|---|---|
| Reason | The LLM inspects the current context and decides what to do next — call a tool, call a different tool, or produce a final answer |
| Act | The chosen tool is executed; its result is appended to the context |
The loop repeats until the LLM decides no more tool calls are needed, at which point it emits a final response.
┌─────────────────────────────────────────────────┐
│ ReAct Loop │
│ │
│ User query │
│ │ │
│ ▼ │
│ ┌────────┐ tool call? ┌──────────────┐ │
│ │ LLM │ ──────────────► │ Tool runner │ │
│ │(Reason)│ ◄────────────── │ (Act) │ │
│ └────────┘ tool result └──────────────┘ │
│ │ │
│ │ no more tool calls │
│ ▼ │
│ Final answer │
└─────────────────────────────────────────────────┘
Why it works
Without acting, an LLM must answer from memory alone — it can hallucinate or give stale data. Without reasoning, a tool-calling system is brittle — it cannot chain calls or adapt based on intermediate results.
ReAct combines both: the model can say "I need the server memory stats before I can diagnose this issue", call the tool, observe the result, and then reason about what to do next.