Guides

How the ReAct Agent Loop Reasons, Acts, and Observes

How the ReAct loop in agentic AI works through Thought, Action, and Observation steps, what the 2022 Yao et al. paper found, and where these agent loops fail.

· Updated
· 11 min read
langchain react-agent ai-agents llm-agents loop-engineering agent-loop
How the ReAct agent loop reasons, acts and observes: Thought, Action and Observation in a repeating cycle
Table of Contents

A ReAct agent loop is what makes an AI agent go look something up before it answers, instead of guessing from memory. A plain model guesses. A ReAct agent stops, decides it needs to check something, calls a tool, reads what came back, and only then answers.

That stop-check-then-continue rhythm is the whole idea behind a ReAct agent loop. Once you see its three repeating steps, a lot of agent behavior gets easier to read.

TL;DR:

  • ReAct stands for Reasoning plus Acting. A ReAct loop is an agent loop that alternates Thought, Action, and Observation until the model can answer.
  • It comes from “ReAct: Synergizing Reasoning and Acting in Language Models” (Yao et al., arXiv 2210.03629, October 2022), published at ICLR 2023.
  • In the paper, ReAct beat acting-only and imitation or RL baselines on ALFWorld and WebShop, beat chain-of-thought on FEVER, trailed it slightly on HotpotQA, and did best on HotpotQA and FEVER when combined with chain-of-thought self-consistency.
  • Every ReAct loop needs a step cap and step-by-step traces, because a frequent ReAct failure pattern is repeating the same thought and action.

What Is a ReAct Loop in Agentic AI?

A ReAct agent loop is an agent loop that interleaves reasoning and acting in one repeating cycle. The model does not reason in one phase and act in another. It alternates: think a little, do a little, look at the result, think again.

ReAct is short for Reasoning and Acting. The name describes the pattern exactly: the model produces a reasoning trace and a task action in the same loop, so each informs the other.

The loop runs on three moves that repeat. A Thought is the model reasoning about what to do next. An Action is a tool call, with its input. An Observation is whatever that tool returns, which the model reads before writing its next thought.

That third move is what sets ReAct apart from a model that just thinks harder. The observation is a real result from outside the model, so the next thought is built on a fact the tool returned, not on an assumption the model made.

It is called a loop because those three moves repeat. One thought, action, and observation is a single turn, and the agent takes as many turns as the task needs before it stops and answers. An easy question might take one turn; a messy one might take six.

Where Did the ReAct Pattern Come From?

The pattern was introduced in the 2022 paper “ReAct: Synergizing Reasoning and Acting in Language Models,” by Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao. It is arXiv:2210.03629, and it was presented at ICLR 2023.

Before ReAct, reasoning (like chain-of-thought prompting) and acting (like generating an action plan) were mostly studied as separate topics. The paper’s move was to let a model generate reasoning traces and task actions together, in an interleaved way.

The two directions feed each other. Reasoning traces help the model track and update its plan and handle surprises. Actions let it reach outside itself, to a search index or an environment, to pull in facts it did not already have.

The idea is simple to adopt. You do not need a special model to run ReAct; you prompt an ordinary one to write its reasoning as a thought, name a tool as an action, and wait for the observation before continuing. LangChain’s agent docs describe an agent as a model calling tools in a loop until the task is complete, and its v1 create_agent replaced the older LangGraph create_react_agent prebuilt.

The paper tested ReAct on question answering (HotpotQA) and fact verification (FEVER) with a simple Wikipedia API of three actions: search, lookup, and finish. Reading real observations cut down on hallucinated facts, though on HotpotQA plain ReAct still trailed chain-of-thought slightly (27.4 vs 29.4 exact match with PaLM-540B), and it beat chain-of-thought on FEVER (60.9 vs 56.3 accuracy).

On two interactive benchmarks, ALFWorld and WebShop, it reports ReAct beating imitation and reinforcement learning methods by an absolute success rate of 34% and 10%, using only one or two examples in the prompt. So when you read that an agent “uses ReAct,” it traces back to this one paper and this one idea: reason and act in the same loop, not in two separate stages. Everything below is a consequence of that choice.

What Did the ReAct Paper Find?

The paper ran its main experiments with few-shot prompting on PaLM-540B, with GPT-3 (text-davinci-002) results in an appendix. On HotpotQA and FEVER the agent had only three Wikipedia actions: search[entity], lookup[string] and finish[answer].

BenchmarkMetricReActCompared with
HotpotQAExact match27.4Chain-of-thought 29.4
FEVERAccuracy60.9Chain-of-thought 56.3
ALFWorldSuccess rate (best trial)71%Act 45%, BUTLER 37%
WebShopSuccess rate40.0%IL 29.1%, IL+RL 28.7%

Pure ReAct was not the top scorer on the knowledge tasks. The best HotpotQA result (35.1) came from running ReAct first and falling back to chain-of-thought self-consistency (CoT-SC) when it ran out of steps, and the best FEVER result (64.6) came from the reverse order.

The paper’s error analysis on HotpotQA explains why. Hallucination caused 56% of chain-of-thought failures and 0% of ReAct failures. ReAct failed differently: reasoning errors, including repeating the same thoughts and actions, made up 47% of its failures, and non-informative search results another 23%. The authors’ own reading is that interleaving makes ReAct more grounded but less flexible in how it reasons, which is why they paired it with CoT-SC.

What Happens in Each Thought, Action, Observation Step?

The three steps are easier to hold onto with a concrete shape. Here is what each one does and what it looks like in a trace.

StepWhat the model doesWhat it looks like
ThoughtReasons about the next move in plain language”I need the current population, I should search for it”
ActionCalls a tool and names its inputsearch("France population 2026")
ObservationReads the tool’s returned result”France population is about 69.1 million”

The cycle repeats. After the observation, the model writes a new thought, takes a new action, reads a new observation, and continues until it has enough to answer.

Here is an illustrative transcript of the shape a ReAct loop produces on a simple lookup task. It is not a log from any real system, and it follows the format the paper itself uses:

Thought: I need the release year of the film, I don't know it.
Action: Search[Blade Runner]
Observation: Blade Runner was released in 1982.
Thought: Now I can answer the question.
Action: Finish[1982]

Read the transcript top to bottom and the loop is obvious. Each thought sets up an action, each action produces an observation, and the model only writes a final answer once an observation has given it what it was missing.

Why Does Interleaving Reasoning and Acting Win?

The natural question is why bother alternating. Why not have the model plan every step first, then run the plan? The reason comes down to when mistakes get caught.

A plan made entirely up front commits to assumptions before checking any of them. If the first assumption is wrong, every step after it inherits the mistake, and nothing in the run catches it until the end.

A ReAct loop checks after every action. If the model guesses wrong on step one, the observation from step one contradicts the guess, and the next thought can correct course. The error can get caught early instead of compounding.

Think of a lookup where the first search returns nothing useful. A plan-first agent keeps executing the rest of its now-broken plan. A ReAct agent sees the empty observation, reasons that the query was bad, and tries a different search on its next action.

That recovery is the practical payoff. Interleaving gives the loop a chance to correct course at each step, so a single bad move does not have to sink the whole run.

Two-column blueprint comparison of a ReAct agent loop against a plan-first agent, showing the ReAct side recovering after a wrong first guess while the plan-first side carries the error through to a wrong answer

Plan-First Agents vs ReAct Agents

It helps to line the two approaches up directly, since real systems use both and the choice is not always ReAct. The table compares when each one reasons, when it acts, and what happens to a wrong assumption.

Plan-first agentReAct agent loop
When it reasonsOnce, up frontAt every step
When it actsAfter the full plan is madeRight after each thought
Handling a wrong assumptionCarries it to the endCan catch it on the next observation
Reasoning left in the traceThe initial plan onlyA thought before every action
Best fitStable tasks with known stepsTasks needing lookups or recovery

The table is not a verdict that ReAct always wins. A task with a fixed, known sequence of steps can run fine with a plan made once, and skips the overhead of reasoning before every action.

ReAct earns its keep when the path is not knowable in advance: when the agent has to look something up, react to what it finds, and possibly change direction. The overhead is real, though. Reasoning before every action means more model calls and more tokens than a plan made once, so for a short, predictable job the extra thinking is cost you do not need to pay.

How Do Modern Agent Frameworks Run the ReAct Loop?

Agent frameworks run the same cycle. The model is called, it chooses a tool and its input, the framework runs the tool, adds the result to the context and calls the model again, until a stopping condition is met, such as a final answer or a step limit.

LangChain is one example: since its v1 release, the recommended way to build an agent is create_agent from langchain.agents, which replaced the older LangGraph prebuilt create_react_agent. The names change between frameworks, but the parts you configure are the ones the paper used: the tools the agent can call, the prompt that tells it how to reason, and the rule that ends the loop.

Where Do ReAct Agent Loops Break Down?

ReAct fails in specific, recognizable ways. Knowing them is the difference between trusting a loop and reverse-engineering a bad answer after the fact.

The first failure is a loop that never stops. If no observation ever satisfies the model, it keeps writing thoughts and calling tools, running up cost and time. Every ReAct loop needs a stop condition, a cap on steps, or both. Diagnosing an agent that gets stuck this way is its own topic.

The fix is a hard step cap and a fallback. The ReAct paper capped runs at 7 steps on HotpotQA and 5 on FEVER, because more steps did not improve results, and in its ReAct-then-CoT-SC setup a run that hit the cap without an answer fell back to CoT-SC. Frameworks expose the same control: LangChain’s ModelCallLimitMiddleware takes a run_limit and a thread_limit on model calls.

A second failure is a bad observation the model trusts anyway. If a tool returns a wrong or empty result and the model treats it as fact, the next thought is built on bad ground. The loop is only as reliable as the tools feeding it observations.

A third is a thought that does not match the action taken. The model reasons about doing one thing, then calls a tool that does another. The reasoning trace looks fine on its own, so this one hides until you read the thought and the action side by side, which is far easier when the steps are recorded one by one instead of collapsed into a final answer.

How to Evaluate and Trace a ReAct Agent

Each failure mode above maps to a check. Future AGI has custom evals: you can write your own grading rule, pick an LLM judge or a deterministic check, and run it on every trace. For ReAct agents, the relevant built-in evaluators line up with the failures:

  • A loop that never stops: Step Count (steps within a min/max range) and Customer Agent: Loop Detection.
  • A thought that does not match the action: Trajectory Match (the action sequence against an expected trajectory) and Tool Call Accuracy (actual tool calls against the expected name and arguments).
  • A bad observation the model trusted: Groundedness and Detect Hallucination.
  • Whether the run did the job at all: Task Completion.

To get those steps in the first place, traceAI’s auto-instrumentation covers LangChain and the OpenAI Agents SDK among 50+ framework integrations, so every model call and tool call shows up as a span in Future AGI tracing. For local test runs, the open-source Agent Learning Kit evaluates traces and task outputs from its own SDK and CLI.

How to Watch Your ReAct Agent Check Its Work

A ReAct loop is one shape an agent loop can take, not a separate machine. The underlying parts, a model, memory, tools, and something to drive the cycle, are the general agent-loop architecture, and that architecture is worth understanding on its own. The named stages that any agent moves through over time are their own separate topic too.

What ReAct pins down is the interleaving: reason, act, observe, repeat. You can drop that pattern into an agent setup without changing the parts around it, and it sits alongside other named agent patterns.

The three moves also map cleanly onto how you would watch the loop run. In trace terms, each model call (where the Thought and the chosen Action are written) and each tool call (the Action and the Observation it returns) becomes its own span.

Future AGI’s open-source traceAI records LLM calls, tool calls, retrieval steps, and agent decisions as OpenTelemetry spans, so a run reads as a sequence of steps instead of one block of text. Future AGI Observe lets you open, search and score those traces.

Because a ReAct loop leaves a thought before every action, the ReAct pattern makes an agent’s reasoning legible, which is what you need when a run goes wrong and you have to figure out why. ReAct settles the shape of each step. For the wider conversation about designing the loop that shape runs in, loop engineering is the related topic to read next.

Back to the agent that looks something up before it answers: every lookup it makes is one Thought, Action, Observation step, and each step is something you can check. The next move is to see those steps on a real run. Instrument your agent with traceAI and score its steps in Future AGI.

Frequently Asked Questions

What is a ReAct agent loop?

A ReAct agent loop is an agent pattern where a language model alternates Thought, Action, and Observation steps, calling tools and reading their results until it can answer. Each observation is real tool output, so the next thought builds on a fact instead of a guess. The loop ends with a final answer or a step cap.

What does ReAct stand for?

ReAct stands for Reasoning and Acting, a pattern where a language model writes reasoning traces and takes task actions in the same interleaved loop. The name comes from the 2022 paper by Yao et al. that introduced it. Reasoning keeps the plan on track, while actions pull in outside facts the model did not already have.

What are the key differences between an LLM agent and a ReAct agent?

An LLM agent is any system where a model chooses actions or tools, while a ReAct agent is one specific design that reasons before each action and reads every result. Other agents may plan all steps up front or call tools without visible reasoning. A ReAct agent checks every result, so it can fix a wrong assumption mid-run.

How to build a ReAct agent?

To build a ReAct agent, give a model tools, prompt it to reason before each call, run the chosen tool, append the result, and repeat until it answers. Frameworks such as LangChain's create_agent provide this loop ready-made. Add a step cap, then trace every model and tool call so failed runs are easy to debug.

Is ReAct still relevant in 2026?

Yes, ReAct is still relevant in 2026, because LangChain's agent docs describe an agent as a model calling tools in a loop until the task is complete. That is the ReAct cycle of reasoning, acting, and observing. LangChain's v1 create_agent now provides that loop, replacing the older LangGraph create_react_agent.

Why does AI get stuck in a loop?

An AI agent gets stuck in a loop when it keeps repeating the same thought and tool call because the observations never give it what it needs. The ReAct paper named this repetition a frequent ReAct error pattern. Set a step cap with a fallback, and flag these runs with Future AGI's Step Count and Customer Agent: Loop Detection evaluators.

What is the ReAct agent paper?

The ReAct agent paper is 'ReAct: Synergizing Reasoning and Acting in Language Models' by Yao et al., posted to arXiv in October 2022 and published at ICLR 2023. It beat imitation and reinforcement learning baselines on ALFWorld and WebShop, beat chain-of-thought on FEVER, and trailed it slightly on HotpotQA. On those two, combining it with chain-of-thought self-consistency scored best.

Is create_react_agent deprecated?

Yes, LangGraph's create_react_agent is deprecated in favor of create_agent from langchain.agents, which LangChain recommends for building agents since its v1.0 release. The underlying ReAct idea is unchanged: the agent calls tools in a loop until a stopping condition is met. Middleware such as ModelCallLimitMiddleware adds a step cap on top.
Related Articles
View all