ReAct Prompting

Authors 5 articles 54 min total read

This topic is curated by our AI council — see how it works.

Every coding agent, research assistant, and tool-using chatbot shipped since 2023 owes its control structure to ReAct prompting — one of the four core patterns that turn a single LLM call into a system that keeps working once you’re gone. Get the loop wrong and an agent burns budget on redundant tool calls or stalls entirely; get it right and it recovers from a bad search result the way a developer would, by trying something else. That is the practical stake behind the prompt engineering theme’s core-patterns tier, and it is why understanding the loop still matters even now that most frameworks hide it behind a native tool-calling API.

  • Understanding the Thought-Action-Observation loop is how you diagnose why an agent looped, picked the wrong tool, or stalled — even when the loop itself is hidden inside a framework’s API contract.
  • Four documented failure modes limit ReAct in production, and none of them show up in a demo running the happy path.
  • Native function calling now handles simple, well-defined lookups faster; ReAct still earns its place for open-ended, multi-step reasoning you need to audit.
  • In 2026 the loop rarely appears as literal prompt text — it is built into agent frameworks and API contracts, which is why LangChain deprecated its standalone AgentExecutor.

The ReAct reading path: loop mechanics before agent debates

Start with what ReAct prompting is and how the Thought-Action-Observation loop gives LLMs the ability to act — it is the one article in this topic allowed to explain the mechanism, and everything downstream assumes you have read it. Follow immediately with the prerequisite concepts and failure modes explainer: it maps what breaks before you write a single line of agent code, which is cheaper to learn from a page than from a production incident.

Once the mechanism and its limits are clear, the Python build guide turns them into a working loop and gives the decision framework for when a plain function call beats the extra reasoning step. For where the pattern actually landed, ReAct in the wild tracks how coding agents absorbed the loop into their API contracts rather than retiring it. Close with the accountability risks of ReAct-based agents acting without consent before you let one take an irreversible action in production.

MONA asks: 'My ReAct agent called the same search tool four times in a row for one question — is that a bug?' MAX answers: 'Not a bug. That's the loop working exactly as built, with no termination condition to stop it.' — comic dialog.
A ReAct loop without an explicit stop condition isn't malfunctioning — it's doing precisely what it was told.

How ReAct differs from its closest neighbours

Three confusions recur once teams start building agent loops.

ReAct is not the same decision as native function calling. Function calling lets a model emit a structured call in one shot; ReAct wraps that call inside an explicit reasoning step before and after it. The two are not exclusive — the production pattern in the build guide is hybrid: a fast function call for a simple lookup, a full ReAct loop only when the next step actually depends on what the last tool returned.

ReAct and prompt chaining are not rivals to pick between. Production pipelines increasingly nest one inside the other: a chain handles the stages you can fix in advance, and a ReAct loop takes over for the one stage where the right next tool depends on what just came back. Treating them as an either/or choice is what leads teams to over-engineer a chain into handling runtime branching it was never built for.

ReAct is not tree of thoughts with tools bolted on. Tree of thoughts explores several hypothetical reasoning branches and scores them before committing to one — none of it touches a real system. ReAct commits to one action per cycle and only finds out if it was right when the environment responds. Confusing the two produces agents that either burn compute exploring branches nobody asked for, or systems that expect a single ReAct call to plan the way a full search would.

Common questions about ReAct prompting

Q: Can a prompt chain and a ReAct loop run in the same pipeline, or do you have to choose one? A: They compose rather than compete — the production pattern in the build guide chains fixed stages together and drops into a ReAct loop only for the one step whose next move depends on a tool’s response. Most real agents mix both rather than picking a single pattern outright.

Q: When does tree of thoughts beat a ReAct loop for a reasoning problem? A: When the problem needs several hypothetical paths compared before any real action, and scoring a partial answer is cheap — tree of thoughts explores those branches without touching a live tool. ReAct is the better fit once the next step genuinely depends on what an external system returns, not on further internal deliberation.

Q: Why does a ReAct agent keep calling the same tool with slightly different inputs instead of stopping? A: Because nothing told it when to stop — the prerequisite failure-modes explainer documents this as one of four recurring breakdowns, and the fix is an explicit termination condition, not a smarter model.

Q: How often do adversarial attacks actually succeed at hijacking a deployed ReAct agent’s actions? A: In one controlled study probing thirty deployed agents with over a thousand attack attempts, roughly one in four succeeded under standard conditions — nearly double with a reinforced attack, a rate the consent and accountability risks piece argues most deployments aren’t governed for.

Part of the prompt engineering theme · closest neighbour: prompt chaining.

1

Understand the Fundamentals

ReAct Prompting structures LLM outputs as a repeating Thought–Action–Observation loop, giving the model a way to reason, act on external tools, and correct course rather than producing a single static response.

2

Build with ReAct Prompting

The guides here cover implementing a ReAct loop from scratch, choosing between a hand-rolled pattern and native function calling, and the trade-offs that decide which approach fits a given use case.

4

Risks and Considerations

ReAct-based agents can take irreversible external actions without explicit user consent at each step—understanding where accountability sits and how to constrain action scope is essential before deploying these systems.