The ReAct Pattern: Reasoning and Acting in Turns
ReAct just means this: the model thinks and acts in turns, instead of doing only one of the two. The name is short for Reasoning and Acting. And that alternation is exactly why so many tool-using AI agents are built on this pattern today.
Picture asking an AI for the current exchange rate. A bare language model guesses — it has never seen the rate, so it fills the gap with something plausible. A ReAct agent does it differently: it reasons briefly that it needs to look the rate up, calls a tool, reads the result, and only then answers. That sounds obvious. For a model that, by default, only continues text, it isn’t.
The Loop: Thought, Action, Observation
The heart of ReAct is a loop of three steps that repeats until the agent is done.
Thought. The model writes down a short reasoning step — what is the goal, what’s missing, what do I do next. This thought is visible text in the trace, not some hidden inner life. That’s exactly what makes the agent traceable.
Action. A thought leads to an action. Usually that’s a tool call: a search, a database query, an API call. The action has a fixed format so the surrounding program can recognize and run it.
Observation. The result of the action — the search hit, the data row, the error message — is written back into the context. This observation becomes the input for the next thought.
Then the loop starts over. New thought, new action, new observation. At some point the model decides it knows enough and, instead of an action, produces the final answer. So a chain of small steps turns into a result that stands on real data rather than a guess.
Why Not Just Reason It Through — the Difference from Chain-of-Thought
With plain chain-of-thought, the model reasons through a problem in one go, step by step, without reaching outside. That’s strong on logic and math tasks, where everything needed is already in its head. It’s weak the moment the model would need something it doesn’t have.
ReAct closes exactly that gap. Instead of only thinking, the agent is allowed to reach into the world in between and look things up. The reasoning stays — the Thought step is chain-of-thought at its core — but it gets grounded by real observations. And that’s where it clicks: an agent that looks things up between thoughts hallucinates less, because the next bit of reasoning builds on a real result instead of a guessed assumption.
In short
Chain-of-thought is thinking without hands. ReAct gives the thinking hands — tools it can use to fetch facts along the way.
Where ReAct Is Strong
The pattern shines wherever a task isn’t solvable up front but needs information gathered along the way.
- Multi-step research. A question that needs one search, then a second search building on the first. The agent adapts its path depending on what the first observation reveals.
- Tool use in general. Calculator, code execution, calendar, database — anything the agent can call slots into the action-observation interplay.
- Transparency. Because every thought is written in plain text, you can read back why the agent made a decision. For debugging and trust, that’s gold. A black box that only spits out the end result you can’t inspect — a ReAct trace you can.
How full agents get built from this is covered in detail in building AI agents. ReAct as a prompting technique sits alongside the other approaches in prompting techniques.
Typical Failure Modes
As elegant as the pattern is, in practice it tips over at a few recurring spots.
Infinite loops. The agent never wraps up. It thinks, acts, observes, thinks the same thing again — and spins in circles without ever triggering the final answer. A hard cap on loop iterations and a clear hint in the prompt about when enough information has been collected both help.
Hallucinated tools. The model invents an action that doesn’t exist — calls a tool that was never defined, or passes parameters in a format no one expects. The surrounding program then can’t read the action. A tight list of available tools in the prompt, plus a clean error observation that pulls the agent back, are the remedies here.
Wrong action format. ReAct lives on the program reliably reading the action out of the text. If the model drifts from the agreed format, the parser breaks. Structured outputs or a strict schema for the action defuse this.
Observation junk. If a tool dumps a huge, unfiltered response, it clogs the context and the model loses the thread. Observations should be trimmed to the essentials before they go into the next round.
Many of these failures are related to what hallucinations in LLMs covers in more depth — the causes overlap.
FAQ
- ReAct is short for Reasoning and Acting. The pattern combines both: the model reasons about its next steps in plain text (Reasoning) and runs actions like tool calls in between (Acting), instead of doing only one of the two.
- Chain-of-thought is pure reasoning with no reach outside. ReAct keeps that reasoning but additionally lets the model use tools in between and observe the results. As a result, the next thought stands on real data instead of a guess.
- It tends to. Because the agent looks up facts between reasoning steps, it has to fill gaps with guesses less often. That lowers the chance of made-up answers — but it doesn't protect against hallucinated tools or the agent getting stuck in loops.
- No. The pattern can be built by hand — a prompt that lays out Thought/Action/Observation, plus a bit of code that runs the action and writes the result back. Frameworks take the parsing and loop control off your hands, but the principle works without one.
- If a task is fully solvable inside the model and needs no external data, the extra loop is just overhead. Plain chain-of-thought or a single answer call is faster and cheaper then.
What exactly does ReAct stand for?
What's the difference between ReAct and chain-of-thought?
Does ReAct really reduce hallucinations?
Do I need a framework for ReAct?
When is ReAct the wrong choice?
Entdecke mehr
AI Workflows by Keyword: How We Make Recurring Routines Enforceable
A typed keyword triggers a fixed AI routine — and every single step must be committed before the next one appears. Why that's the actual trick.
GlossarEnsemble / Multi-Model Orchestration
Ensemble means combining several deliberately varied LLM runs or models whose findings complement each other. Multi-model orchestration drives these runs via orchestrators with sub-agents, so the union of results is larger than any single run.
LexikonAgentic Workflows vs. Agents — when to fix, when to free
The difference between fixed, predefined workflows and autonomous AI agents — with Anthropic's definition, the trade-offs, and a clear decision guide.