A language model can produce fluent answers while still lacking the information or capabilities a task requires. Its training data may be stale; the answer may depend on a private database, a live service, or several steps of interaction. Asking the model to continue writing does not, by itself, give it access to those sources.
ReAct—short for Reasoning and Acting—is a research paradigm for interleaving language-model reasoning with actions in an external environment. The model uses a step of reasoning to decide what to do, receives an observation from that action, and uses the new context to decide what comes next. The 2022 paper evaluated this idea on question answering, fact verification, and interactive tasks; it is a useful conceptual ancestor to many current tool-using agents, though it is not a particular library or product.[1]
What Is ReAct?
In the paper, a trajectory contains three kinds of step:
- Reasoning: language that helps the model decompose a goal, track what it knows, make a plan, or revise that plan.
- Acting: a task-specific command sent to an environment, such as searching Wikipedia, clicking a control, or moving an agent in a text world.
- Observation: the environment's response to an action. It becomes new context for a later decision.
Reasoning can guide which action to take; an observation can supply facts or state that change the next reasoning step. This feedback loop is what distinguishes ReAct from generating a plan once and then blindly executing it.
This is a conceptual description of the interaction loop. It does not mean every modern implementation exposes private chain-of-thought, uses the paper's textual labels, or represents model state in the same way. A production system can keep internal reasoning private and expose only tool calls, concise status, and the final answer.
How ReAct Works: A Search Example
Imagine someone asks, “Which city is the headquarters of the organization that operates the museum I mentioned?” The agent cannot answer reliably unless it knows which museum and has trustworthy information about its operator and headquarters. A search-enabled agent might follow this conceptual sequence:
- Notice that the operator and its headquarters are missing from the conversation.
- Choose a search tool and query for the museum's operator.
- Run the query against the configured search service.
- Inspect the returned pages and identify a credible source that names the operator.
- Search for the operator's headquarters if the first result did not establish it.
- Answer with the city and cite the sources actually returned by the tool.
The example describes a possible workflow; it does not claim that a live search was run or invent search results. In a real system, the source quality, dates, and relevant passages must be checked before answering.
At a high level, an agent runtime repeats a cycle like this:
The loop makes the observation part of the next decision. The step limit and tool allowlist are deliberate engineering controls, not incidental details.
ReAct vs. Chain-of-Thought vs. Act-Only
| Approach | What it does | Strength | Limitation | Good fit |
|---|---|---|---|---|
| Reasoning-only (often prompted with chain-of-thought) | Generates intermediate reasoning and an answer from the prompt and model knowledge. | No tool integration is needed; useful for self-contained reasoning tasks. | Cannot independently fetch missing or current facts; a plausible reasoning trace can still contain errors. | Closed-world questions, transformations, and tasks where required information is already supplied. |
| Act-only | Selects actions and reacts to results without explicitly interleaving natural-language reasoning. | Can interact with an environment and may suit direct, repetitive action mapping. | High-level plans and progress can be harder to inspect or adapt when the task changes. | Simple policies with clear state transitions and well-defined actions. |
| ReAct | Interleaves reasoning, actions, and observations. | Can use feedback to update a plan while leaving a human-readable task trajectory. | May choose poor tools, misread results, loop, or spend more time and tokens. | Tasks that need both multi-step decisions and external feedback. |
External observations can ground an answer in data retrieved for this particular task, reducing reliance on what the model merely recalls. They do not guarantee correctness: a search result can be stale, a database can be wrong, and the model can misinterpret valid evidence. ReAct does not eliminate hallucinations.
Inside the Original Research
Yao and colleagues evaluated prompted PaLM-540B agents and also explored fine-tuning smaller PaLM models using successful ReAct trajectories. The interactive environments were ALFWorld and WebShop; the factual tasks, HotpotQA and FEVER, used a simple Wikipedia API. The reported figures below are results from those historical experimental setups, not estimates of how a current commercial agent will perform.[1][2]
- HotpotQA is multi-hop question answering: answering often requires connecting evidence across multiple Wikipedia articles. In the paper's six-shot PaLM-540B results, exact match was 28.7 for the standard prompt, 29.4 for reasoning-only, 25.7 for act-only, and 27.4 for ReAct. A combined ReAct and chain-of-thought strategy reached 35.1. ReAct alone therefore did not beat CoT on this benchmark; the combination did best among the listed prompting methods.
- FEVER is fact verification: classify a claim against evidence as supported, refuted, or not enough information. In the paper's three-shot setup, accuracy was 57.1 standard, 56.3 reasoning-only, 58.9 act-only, and 60.9 ReAct. The best combined ReAct and CoT method reached 64.6.
- ALFWorld maps text instructions to interactive household tasks in a text-based embodied environment. With two-shot prompting, the reported success rate was 45% for act-only and 71% for ReAct.
- WebShop is an interactive simulated shopping website where an agent must find products that satisfy natural-language constraints. With one-shot prompting, act-only achieved 30.1% success and ReAct 40%.
For ALFWorld and WebShop, the authors reported ReAct's success rate as an absolute improvement of 34 and 10 percentage points, respectively, over the imitation-learning baselines they compared against (37% and 29.1%). These are benchmark-specific comparisons with different training and prompting conditions; they should not be generalized to deployment performance.
The paper also discusses failure cases. On HotpotQA, manual analysis found ReAct trajectories could repeat previous reasoning and actions, and unhelpful search results could derail an answer. Reasoning-only sometimes performed better on HotpotQA, while ReAct was stronger on FEVER. That is an important lesson: tool access can improve grounding, but adds new failure modes and does not automatically improve every task. The work's few-shot evaluation, specific model and APIs, and benchmark environments also limit direct comparison with modern systems.
The authors further explored fine-tuning PaLM-8B and PaLM-62B with ReAct-format trajectories, reporting that fine-tuned ReAct models improved over prompting baselines in their HotpotQA experiments. This is a separate experiment from the few-shot numbers above.
ReAct in Modern Agent Architectures
ReAct names a research pattern; current frameworks provide ways to implement workflows that may or may not follow it:
- Tool or function calling gives a model a schema for requesting an operation. Application code validates the arguments, invokes the function, and returns its result to the model. The model's tool request is an action; the returned result is an observation.
- Search and external APIs provide live or organization-specific information. They need access controls, source handling, timeouts, and validation.
- Retrieval-Augmented Generation (RAG) retrieves relevant documents and supplies them as context for an answer. A basic RAG pipeline is usually a fixed retrieve-then-generate workflow. It becomes ReAct-like only when the model can decide to retrieve, inspect what came back, and choose another action based on that observation.
- LangChain offers components and agent abstractions for composing models and tools. An agent configured with a ReAct-style prompt follows that pattern; not every LangChain agent does.
- LangGraph models workflows as stateful graphs, including cycles, branches, and explicit stop conditions. It can implement a ReAct loop, but a graph can just as well encode a deterministic workflow without model reasoning or tool selection.
In a controlled implementation, state may hold the user's request, prior observations, validated tool outputs, attempt count, and final response. The workflow should define what happens after tool errors, when to retry, how many model turns are allowed, and exactly when to stop. Those decisions belong in the application's control flow even if the model suggests actions.
Practical Implementation: A Bounded Tool-Calling Loop
Below is a small implementation illustration using the OpenAI Python SDK and the Responses API's documented function-calling flow. It provides one local lookup tool backed by a tiny sample dataset, so it is runnable without a web-search service. The data is illustrative and is not a claim about live facts. Install the SDK with python -m pip install openai, set OPENAI_API_KEY in your environment, save this as agent.py, then run python agent.py. Set OPENAI_MODEL to a model available to your account if needed.[5]
In this example the application, not the model, executes the function and enforces the iteration bound. A production version would add timeouts, structured error results, logging, authentication and authorization checks, and source citations. This illustrates the action-observation loop; it is not the original paper's experimental code.
Limitations and Engineering Trade-offs
- Wrong tool or arguments: constrain available tools, validate inputs, and reject calls outside the user's permissions.
- Misread or poor observations: preserve provenance, check freshness and quality, and require evidence for high-impact claims.
- Failures and unreliable sources: use timeouts, bounded retries, clear error results, and safe fallbacks. A retry should not blindly repeat an action with side effects.
- Latency and cost: each reasoning turn and tool request adds time and may add model tokens. Use fixed steps when the process is predictable.
- Runaway loops: enforce an iteration limit, a time budget, and explicit finish or handoff conditions.
- Security and permissions: treat retrieved text as untrusted input, limit tool capabilities, separate read and write actions, and require human approval for consequential operations.
A single LLM call is often best when the prompt already contains everything needed. A deterministic workflow is preferable when steps and rules are known in advance. Use RAG when the main problem is grounding an answer in a document collection and retrieval can follow a stable pipeline. A graph-based workflow helps when branches, retries, approvals, or state transitions must be explicit and auditable. ReAct-style autonomy is useful when the model must choose among actions based on evolving observations, and the task justifies its added complexity.
Final Takeaways
ReAct's central idea is simple: let a model reason about the next step, act through a tool or environment, and use the resulting observation to update what it does next. It connected language-model reasoning with interactive feedback, and the original research showed meaningful gains on some benchmarks while also documenting trade-offs.
- Keep reasoning, action, and observation conceptually distinct.
- Use tool results as evidence, and verify their quality and relevance.
- Do not treat a framework name as proof that a workflow uses ReAct.
- Bound the loop, validate tool calls, and define a clear stop or handoff.
- Choose the simplest architecture that meets the task's needs.
References
- Yao et al., “ReAct: Synergizing Reasoning and Acting in Language Models,” ICLR 2023. See the paper for experimental setup, benchmark tables, and failure analysis.
- Google Research, “ReAct: Synergizing Reasoning and Acting in Language Models”, overview and reported results.
- Official ReAct project page, including the paper's examples and project overview.
- Official ysymyth/ReAct repository, including experimental notebooks, README, and MIT license.
- OpenAI API documentation, Function calling, consulted for the Responses API example.
The diagrams in this article are original illustrations created for this post. They explain the general interaction pattern and do not reproduce benchmark results or research figures.
