What Is ReAct (Reasoning + Acting)?
Quick Definition#
ReAct (Reasoning + Acting) is an agent design pattern that interleaves natural language reasoning traces with tool-use actions, enabling AI agents to solve multi-step tasks by thinking through each step, acting on that thinking, and updating their reasoning based on what they observe. The pattern follows a Thought → Action → Observation loop that continues until the agent reaches a final answer.
ReAct is foundational to understanding how modern AI agents work. It builds on chain-of-thought reasoning but grounds that reasoning in real-world tool calls. For a broader overview of how agents plan and execute, see AI Agent Planning and Tool Calling. Browse all AI agent terms in the AI Agent Glossary.
Why ReAct Matters#
Before ReAct, LLMs faced a fundamental trade-off between two approaches:
- Pure reasoning (chain-of-thought): The model reasons internally but cannot access external information, leading to hallucinations on factual questions
- Pure action (direct tool calling): The model calls tools without reasoning, making it hard to debug why it made certain choices or to handle unexpected results
ReAct resolves this trade-off by combining both. The reasoning trace makes the agent's decision process transparent and correctable. The action steps ground the reasoning in real data. The observation loop allows the agent to adapt when tools return unexpected results.
For developers, this means:
- Debuggability: You can read the Thought steps to understand why the agent took each action
- Flexibility: The agent can adapt its plan mid-execution based on what tools return
- Accuracy: External tool calls replace reliance on the model's potentially outdated or incorrect internal knowledge
How ReAct Works#
The ReAct loop consists of three alternating step types:
Thought#
The agent generates a reasoning trace describing its current understanding, what it knows, what it needs to find out, and what action it plans to take next. This is internal — not a tool call, just the agent "thinking out loud."
Action#
The agent calls a tool (search engine, calculator, database query, API call) with specific parameters derived from its reasoning.
Observation#
The tool returns results, which are injected back into the context. The agent reads the observation and generates the next Thought, either taking another action or producing a final answer.
A Concrete Example#
A user asks: "What is the current population of the largest city in Brazil, and how does it compare to New York?"
Thought: I need to find the largest city in Brazil first, then get its population,
then compare to New York. Let me search for the largest city in Brazil.
Action: search("largest city in Brazil by population")
Observation: São Paulo is the largest city in Brazil with a population of
approximately 12.3 million in the city proper, or 22 million in the
greater metropolitan area.
Thought: São Paulo is the answer. Now I need New York's population for comparison.
Action: search("New York City population 2025")
Observation: New York City has approximately 8.3 million people in the city proper
and 20 million in the greater metropolitan area.
Thought: I have both figures. São Paulo city proper (12.3M) is larger than NYC city
proper (8.3M), but their metropolitan areas are comparable. I can now
provide a complete answer.
Final Answer: São Paulo, Brazil's largest city, has approximately 12.3 million
residents — about 48% more than New York City's 8.3 million. Their
metro areas are more comparable: São Paulo (~22M) vs NYC (~20M).
Each Thought step makes the reasoning explicit. Each Action step calls a real tool. Each Observation updates the reasoning context.
ReAct vs. Chain-of-Thought#
| Dimension | Chain-of-Thought | ReAct |
|---|---|---|
| Reasoning style | Internal only | Internal + external |
| Tool access | None | Yes — search, APIs, databases |
| Hallucination risk | Higher (no grounding) | Lower (facts from tools) |
| Transparency | High (shows reasoning) | High (shows reasoning + actions) |
| Latency | Low (no tool calls) | Higher (tool calls add time) |
| Best for | Math, logic, structured problems | Factual questions, research tasks |
| Failure mode | Hallucinates facts | Gets stuck in loops, tool failures |
Use chain-of-thought when the task is purely logical (math, code analysis, argument evaluation) and you have confidence the model's training data covers it. Use ReAct when the task requires current facts, real-world lookups, or any information not reliably in the model's training data.
ReAct in Practice: LangChain Implementation#
LangChain's create_react_agent() implements the ReAct pattern with a standard prompt format:
from langchain import hub
from langchain.agents import create_react_agent, AgentExecutor
from langchain_openai import ChatOpenAI
from langchain_community.tools import DuckDuckGoSearchRun
from langchain_community.utilities import WikipediaAPIWrapper
from langchain.tools import Tool
# Define tools
search = DuckDuckGoSearchRun()
wikipedia = WikipediaAPIWrapper()
tools = [
Tool(name="Search", func=search.run,
description="Search the web for current information"),
Tool(name="Wikipedia", func=wikipedia.run,
description="Look up factual information on Wikipedia"),
]
# Load the standard ReAct prompt (Thought/Action/Observation format)
prompt = hub.pull("hwchase17/react")
# Create ReAct agent
llm = ChatOpenAI(model="gpt-4o", temperature=0)
agent = create_react_agent(llm, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
# Run the agent — verbose=True shows the Thought/Action/Observation loop
result = agent_executor.invoke({
"input": "What is the GDP of the largest economy in Southeast Asia?"
})
print(result["output"])
With verbose=True, you can see each Thought, Action, and Observation as the agent works through the problem.
ReAct Variants and Evolutions#
ReAct with Self-Reflection (Reflexion)#
An extended pattern where, after failing to solve a task, the agent reflects on what went wrong and tries again with an updated strategy. Useful for tasks where the first approach often fails.
ReAct + RAG (Agentic RAG)#
The agent uses retrieval as one of its available tools, deciding when to search a knowledge base and what query to use. This is the foundation of Agentic RAG.
Structured ReAct (Tool-Calling APIs)#
Modern LLM APIs (OpenAI, Anthropic) implement ReAct implicitly through structured tool-calling — the model generates tool call objects rather than text-formatted Action steps, making parsing more reliable. The Thought step becomes internal chain-of-thought or explicit reasoning tokens.
Real-World Use Cases#
Research agent#
A research assistant uses ReAct to answer complex questions by searching multiple sources, comparing results, and synthesizing a coherent answer — each search is an Action, each result is an Observation.
Code debugging agent#
An agent uses ReAct to diagnose a failing test: Thought (analyze the error), Action (read the relevant file), Observation (see the code), Thought (hypothesize the bug), Action (run a targeted test), Observation (confirm or disprove).
Data analysis agent#
An agent uses ReAct to answer "What drove the revenue decline last quarter?" by querying a database (Action), interpreting the results (Observation), then querying another table for context (another Action-Observation cycle) before synthesizing the final analysis.
Common Misconceptions#
Misconception: ReAct always requires explicit Thought/Action/Observation labels in prompts Modern LLM tool-use APIs implement the ReAct loop without requiring explicit text labels. The underlying logic — reason, act, observe, repeat — is the same even when the format differs.
Misconception: ReAct eliminates hallucination ReAct reduces hallucination on tasks where tools can provide grounding information. But the model still hallucinates in the Thought steps, and may misinterpret tool observations. Hallucination elimination requires additional verification and human review.
Misconception: More Thought-Action cycles always produce better results Excessive cycles add latency and cost, and can introduce contradictions as more observations accumulate in context. Setting maximum iteration limits and using confidence-based stopping conditions is important for production systems.
Related Terms#
- Chain-of-Thought — The reasoning-only predecessor to ReAct
- Tool Calling — How agents invoke the Action steps
- Agent Planning — How agents decide what to do next
- Agent Loop — The execution cycle ReAct implements
- Agentic RAG — ReAct applied to retrieval-augmented generation
- Build AI Agent with LangChain — Tutorial implementing ReAct agents with LangChain's AgentExecutor
- Build Your First AI Agent — Getting started guide for AI agent development
Frequently Asked Questions#
What does ReAct stand for in AI agents?#
ReAct stands for Reasoning and Acting. It is a framework that interleaves natural language reasoning (Thought steps) with tool-use actions (Action steps) and observations from the environment (Observation steps), enabling agents to solve complex tasks through an adaptive Think-Act-Observe loop.
How does ReAct differ from chain-of-thought prompting?#
Chain-of-thought reasons internally without calling external tools. ReAct adds action steps that call real tools (search, databases, APIs) and incorporates their results back into the reasoning chain. This grounding in external observations dramatically reduces hallucination on factual tasks.
What frameworks implement the ReAct pattern?#
LangChain implements ReAct through create_react_agent() with explicit Thought/Action/Observation prompting. LangGraph supports ReAct as a graph-based workflow. OpenAI and Anthropic's tool-calling APIs implement the same underlying loop through structured tool call objects rather than text-formatted prompts.
What are the limitations of ReAct?#
ReAct can get stuck in reasoning loops, adds latency per Thought-Action-Observation cycle, depends on the underlying model's reasoning quality, and fails when available tools cannot answer the question. For simple tasks, it adds unnecessary overhead compared to direct tool calling.
Is ReAct still the standard approach for AI agents in 2026?#
ReAct's core principle — interleaving reasoning with action — remains the foundation of most agent architectures. While frameworks have evolved to use structured tool-calling APIs rather than explicit text prompts, the Thought-Act-Observe loop is still how agents like GPT-4o, Claude, and Gemini operate when given tools.