What is a ReAct agent?
A ReAct agent is a language model prompted to alternate reasoning and acting. It writes a short thought about what to do next, takes an action such as a search, reads the observation, and thinks again until it can answer. The pattern comes from the 2022 ReAct paper by Yao et al.; most tool-using agents descend from it.
Part of Glossary: the terms behind MCP, coding agents and shared pages, defined plainly.
The prompt shows a few worked examples of a task solved as Thought, Act and Obs lines. The paper used one to six.
The model writes a Thought: what it knows, what is missing, what to do next. A thought changes nothing outside the model, so it gets no observation.
It writes an Act, one of a small set the harness understands. In the paper's Wikipedia tasks: search[entity], lookup[string], finish[answer].
The harness runs the action and appends the Obs, the text that came back. The model reads it and writes the next Thought.
It ends with finish[answer]. Everything in between is a readable trace of why it did what it did.
Thought 1: I need the year the album came out. Act 1: search[album name] Obs 1: ... released in 1997 ... Thought 2: 1997. I can answer. Act 2: finish[1997]
Source: Yao et al., ReAct: Synergizing Reasoning and Acting in Language Models
ReAct versus chain of thought
Before ReAct, the two lines of work were separate. Chain-of-thought prompting had the model reason step by step but only from what it already knew, so it could reason its way confidently to a made-up fact. Action-only agents could look things up but had no place to plan, so they wandered. Yao and colleagues, in a paper submitted in October 2022 and presented at ICLR 2023, put the two in one trace. Formally they added the space of language to the agent's action space: a thought is an action that does not affect the external environment and so gets no observation back, but it changes what the model does next.
The error analysis is the part worth remembering. On the question-answering tasks, chain of thought hallucinated facts in 56% of its failures; ReAct's failures were mostly reasoning errors and searches that returned nothing useful. Grounding fixed one problem and exposed another. The authors' practical answer was to combine them: run ReAct, and if it has not finished within a step budget, fall back to chain of thought with self-consistency. That mix gave the best prompting results on both benchmarks.
Example: a ReAct trace
The paper's question-answering setup gives the model three actions against Wikipedia: search[entity] returns the first five sentences of a page, lookup[string] finds the next sentence containing a string, like Ctrl+F, and finish[answer] ends the task. A trace reads like a person's notes. Thought: the question asks about the device, so I should search for it. Act: search. Obs: the five sentences. Thought: the page does not say which company, I should look up the maker. Act: lookup. Obs: the sentence. Thought: now I know, finish.
The same shape runs a coding agent. Swap the three Wikipedia actions for read file, run command and edit, and swap the Thought line for the model's planning text, and you have Claude Code or Codex. The decision-making results in the paper, 71% on ALFWorld against 45% for actions alone and 40% on WebShop against 30.1%, were reached with one or two examples in the prompt and no fine-tuning.
Where it shows up today
Almost everywhere, usually unnamed. Function calling replaced the text-parsed Act line with a structured tool request; extended thinking or a scratchpad replaced the Thought line; the Obs became a tool result message. LangChain's early agent executor was a direct implementation and made the name common. When a vendor describes an agent as reasoning, calling tools and reading results in a loop, that is ReAct with better plumbing.
Common mistakes
- Too many actions. The paper worked with three. A model offered forty tools spends its thoughts choosing between them. Keep the action set small and the descriptions precise.
- Thoughts that do not use the observation. If the model's reasoning after a search does not mention what the search returned, the loop has decoupled. Check traces for this; it is the most common silent failure.
- No step limit. The paper capped HotpotQA at seven steps because more did not help. Agents without a cap repeat a failing search until the context fills.
FAQ
- Is a ReAct agent related to React, the JavaScript library?
- No. The name is Reasoning plus Acting, from a 2022 paper by Shunyu Yao and colleagues at Princeton and Google. If you search for it alongside front-end code you will get the wrong results; add 'Yao' or 'reasoning and acting' to the query.
- Why does a ReAct agent write its thoughts out instead of just acting?
- The paper's ablation answered this. Removing the thoughts and keeping only actions dropped success on the ALFWorld household tasks from 71% to 45%. The thought is where the model tracks what it has learned, notices a dead end and changes plan. Without it, the model repeats actions that already failed.
- Is a ReAct agent the same as function calling?
- Function calling is the API feature that lets a model request a tool in a structured way. ReAct is the older prompting pattern that achieved the same thing with text: the model wrote search[...] and the harness parsed it. Modern agents use function calling for the Act step and extended thinking or a scratchpad for the Thought step. The loop is the same.
Stop sending HTMLover Slack.
Create an account in a minute, connect your coding agent, and make your first board.