ReAct Framework
Reasoning and Acting, interleaved. ReAct taught language models to think before they act, observe the result, and think again — creating the iterative loop that became the blueprint for every modern AI agent.
Introduced: ReAct was published in 2022 by Yao et al. at Princeton and Google Brain. The paper demonstrated that large language models could dramatically improve on knowledge-intensive tasks by interleaving reasoning traces (Thought) with concrete actions (Action) and their results (Observation) in an iterative loop. Rather than generating a single reasoning chain or executing a single tool call, ReAct models alternate between thinking and doing — using each observation to refine the next thought. The approach outperformed both pure chain-of-thought reasoning and pure action-only baselines on question-answering and decision-making benchmarks.
Modern LLM Status: ReAct’s core insight — that models should reason about when and how to use tools — has been deeply absorbed into modern LLM agent architectures. Techniques like LangChain, AutoGPT, and OpenAI’s function calling all build directly on the Thought-Action-Observation loop that ReAct introduced. Claude, GPT-4, and Gemini now perform this pattern natively when using tools. However, ReAct’s explicit format remains valuable when you need fully transparent, auditable agent behavior where each reasoning step and tool invocation is visible, debuggable, and controllable. It is widely regarded as one of the most influential prompting frameworks ever published.
Think, Then Do, Then Learn
Before ReAct, language models had two modes: they could reason about a problem (chain-of-thought) or they could take actions (tool use). But reasoning without acting produces plausible-sounding hallucinations, and acting without reasoning produces blind tool-calling that lacks strategic direction. Neither mode alone is sufficient for complex, real-world tasks.
ReAct fuses both capabilities into a single loop. The model first generates a Thought — analyzing the current situation, identifying what it knows and what it needs to find out. Then it takes an Action — searching for information, performing a calculation, or invoking an external tool. The result comes back as an Observation, which feeds into the next Thought. This cycle continues until the model has enough information to produce a final answer or complete the task.
Think of it as the scientific method compressed into a prompt: hypothesize, experiment, observe, refine. Each loop iteration grounds the model’s reasoning in real-world evidence rather than pure speculation.
When reasoning and acting are separate, the model either builds an elaborate plan that never touches reality (chain-of-thought hallucination) or blindly fires off tool calls without understanding why (action-only chaos). ReAct’s interleaving forces the model to justify each action with a thought and ground each thought with an observation. This mutual constraint dramatically reduces hallucination while keeping the model goal-directed. The result: more accurate answers, fewer wasted actions, and a fully transparent reasoning trail.
The ReAct Loop
Three phases repeated until the task is resolved
Thought — Reason About the Situation
The model analyzes the current state of the problem. What does it already know? What is still missing? What should the next step be? The Thought phase makes the model’s internal reasoning explicit and visible, allowing you to verify its logic before any action is taken.
“I need to find out when the Eiffel Tower was built and who designed it. I’ll start by searching for the construction history of the Eiffel Tower.”
Action — Execute a Concrete Step
Based on the reasoning from the Thought phase, the model takes a specific, targeted action. This could be searching a knowledge base, calling an API, performing a calculation, looking up a database, or any other tool invocation. The action is always grounded in the preceding thought — never random or speculative.
Action: Search[“Eiffel Tower construction history designer”]
Observation — Process the Result
The result of the action is returned to the model as an Observation. This is external evidence — real data from the environment rather than the model’s own generation. The observation grounds the next reasoning step in fact, reducing hallucination and keeping the model anchored to reality.
Observation: The Eiffel Tower was constructed from 1887 to 1889 and designed by Gustave Eiffel’s engineering company for the 1889 World’s Fair in Paris.
Repeat — Iterate Until Resolved
The observation feeds into a new Thought, which may trigger another Action, producing another Observation. The loop continues until the model has gathered enough evidence to produce a confident final answer. Each iteration builds on the previous, creating a compounding chain of grounded reasoning that converges toward the solution.
“Now I know the designer and dates. The user also asked about the tower’s height. I need one more search to confirm that detail before I can give a complete answer.”
See the Difference
Why interleaving reasoning with action outperforms either alone
Pure Reasoning
What is the population of the country where the 2024 Olympics were held, and how does it compare to the country that hosted the previous Summer Olympics?
The 2024 Olympics were held in France, which has a population of about 67 million. The previous Summer Olympics were in Tokyo, Japan, which has a population of approximately 125 million. Japan has roughly twice the population of France.
ReAct
Thought: I need to find which country hosted the 2024 Olympics and its current population.
Action: Search[“2024 Summer Olympics host country”]
Observation: The 2024 Summer Olympics were held in Paris, France.
Thought: Now I need France’s current population and the previous host.
Action: Search[“France population 2024”]
Observation: France’s population in 2024 is approximately 68.4 million.
Thought: The previous Summer Olympics were Tokyo 2020 (held 2021). I need Japan’s current population.
Action: Search[“Japan population 2024”]
Observation: Japan’s population in 2024 is approximately 123.3 million.
France (2024 host) has 68.4 million people. Japan (previous host, Tokyo 2020) has 123.3 million. Japan’s population is about 1.8 times larger than France’s, though Japan’s population is declining while France’s remains stable.
Practice Responsible AI
Always verify AI-generated content before use. AI systems can produce confident but incorrect responses. When using AI professionally, transparent disclosure is both best practice and increasingly a legal requirement.
48 US states now require AI transparency in key areas. Critical thinking remains your strongest tool against misinformation.
ReAct in Action
See the Thought-Action-Observation loop applied to real scenarios
“Which magazine was started first: Arthur’s Magazine or First for Women?”
Thought 1: I need to find the founding dates of both magazines to compare them. I’ll start with Arthur’s Magazine.
Action 1: Search[“Arthur’s Magazine founding date”]
Observation 1: Arthur’s Magazine was an American literary periodical published in Philadelphia from 1844 to 1846.
Thought 2: Arthur’s Magazine started in 1844. Now I need to find when First for Women was started.
Action 2: Search[“First for Women magazine founding date”]
Observation 2: First for Women is a woman’s magazine published by Bauer Media Group, launched in 1989.
Thought 3: Arthur’s Magazine (1844) was started well before First for Women (1989). I can now answer the question.
Final Answer: Arthur’s Magazine was started first. It was founded in 1844, while First for Women was not launched until 1989 — a gap of 145 years.
“Find the cheapest round-trip flight from New York to London for next month and tell me the airline.”
Thought 1: I need to search for flights from New York to London. I should check a flight comparison tool with flexible dates for next month to find the cheapest option.
Action 1: SearchFlights[origin=“JFK”, destination=“LHR”, dates=“next month”, sort=“price”]
Observation 1: Results returned 47 options. Cheapest round-trip: $412 on Norse Atlantic Airways, departing Mar 15, returning Mar 22.
Thought 2: The cheapest flight is $412 on Norse Atlantic. However, I should verify whether this price includes all fees, since budget airlines sometimes add significant surcharges.
Action 2: Lookup[“Norse Atlantic Airways baggage and booking fees”]
Observation 2: Norse Atlantic includes one carry-on bag. Checked baggage starts at $60 each way. No hidden booking fees.
Thought 3: With checked baggage, the total cost would be approximately $532. The next cheapest option may be more competitive when all fees are included. But the user asked specifically for the cheapest flight, so I’ll report the base fare and note the baggage caveat.
Final Answer: The cheapest round-trip flight is $412 on Norse Atlantic Airways (JFK to LHR, Mar 15–22). Note: this is the base fare; checked baggage adds approximately $120 round-trip.
“Check if our production server’s SSL certificate is expiring within the next 30 days, and if so, renew it.”
Thought 1: I need to check the SSL certificate expiration date for the production server first. I’ll query the certificate details to determine the expiry.
Action 1: CheckSSL[host=“api.example.com”, port=443]
Observation 1: Certificate issuer: Let’s Encrypt. Valid from: 2024-11-15. Expires: 2025-02-13. Days until expiry: 18.
Thought 2: The certificate expires in 18 days, which is within the 30-day threshold. I need to initiate the renewal process. Since this is a Let’s Encrypt certificate, I can use certbot to renew it.
Action 2: RunCommand[“certbot renew --cert-name api.example.com --dry-run”]
Observation 2: Dry run successful. The certificate for api.example.com would be renewed. No errors encountered.
Thought 3: The dry run passed. I should now execute the actual renewal and verify the new expiration date.
Action 3: RunCommand[“certbot renew --cert-name api.example.com”]
Observation 3: Certificate renewed successfully. New expiry: 2025-05-14.
Final Answer: The SSL certificate was expiring in 18 days (Feb 13, 2025). It has been successfully renewed and is now valid until May 14, 2025.
When to Use ReAct
Best for tasks that require both reasoning and real-world interaction
Perfect For
Any task where the model needs to search, calculate, query databases, or call APIs — ReAct provides the reasoning framework that decides when and how to use each tool.
Problems that cannot be solved in a single step — debugging, research, investigation — where each observation shapes the next action.
When you need to audit, debug, or explain an AI agent’s decision-making process — ReAct makes every step visible and verifiable.
Questions that require looking up and cross-referencing multiple facts — ReAct grounds each claim in retrieved evidence rather than memorized data.
Skip It When
Writing an email, summarizing a document, or answering a factual question from memory — the Thought-Action-Observation loop adds unnecessary overhead.
Without tools to call, the Action step becomes simulated reasoning rather than real interaction — plain chain-of-thought may be more efficient in this case.
Each loop iteration adds round-trip time for tool calls. When sub-second response times matter more than verification depth, simpler approaches may be preferable.
Use Cases
Where the ReAct pattern delivers the most value
Debugging and Troubleshooting
Systematically investigate bugs by reasoning about symptoms, checking logs, testing hypotheses, and narrowing down root causes through iterative observation.
Research and Fact-Finding
Answer complex questions by searching for evidence, cross-referencing sources, and building verified answers from multiple observations rather than relying on memorized knowledge.
Autonomous Agent Systems
Power AI agents that navigate websites, manage files, operate software, or interact with APIs — each action guided by reasoning about the observed state.
Security Incident Response
Trace attack vectors by reasoning about indicators of compromise, querying security logs, and following evidence chains to identify the scope and impact of an incident.
Data Analysis Workflows
Explore datasets iteratively — formulate hypotheses, run queries, observe results, refine analyses — building insights through a grounded, step-by-step investigative process.
Planning and Strategy
Evaluate options by gathering information about constraints, market conditions, and trade-offs — each research step informing the strategic reasoning that follows.
Where ReAct Fits
ReAct bridges pure reasoning and fully autonomous agent behavior
Every major AI agent framework — LangChain, AutoGPT, CrewAI, Microsoft AutoGen — implements some version of the ReAct loop at its core. When you see an AI assistant “thinking” before calling a tool, then interpreting the result, you are watching ReAct in action. Understanding this pattern gives you insight into how virtually all modern agentic AI systems operate under the hood.
Related Techniques & Frameworks
Explore the techniques that connect to ReAct
Build Your Own Agent Loop
Try ReAct-style prompting with our interactive tools or explore the foundations that power modern AI agents.