Home › Prompt Engineering › ReAct
✍️ · Ground

ReAct

Interleaving reasoning steps with tool actions so the model can act and observe.

In one line

ReAct lets a model think, act, observe, and repeat until it solves a task.

ConceptWhat it is

ReAct (Reason and Act) is a prompting pattern where a model alternates between generating a reasoning thought and taking an action, such as calling a tool or search, then observing the result before continuing. It exists because pure chain-of-thought reasoning cannot access live information or execute real operations, while pure tool-calling without reasoning often picks the wrong tool or misinterprets results.

By interleaving thought, action, and observation, the model can course-correct mid-task based on real feedback rather than committing to a single plan upfront.

How it worksThe mechanics

The model generates a thought describing what it needs next, then an action specifying a tool call, like a search query; the tool executes and returns an observation, which is fed back into the prompt, and the cycle repeats until the model has enough information to produce a final answer.

At a glanceSee it

ReAct diagram
ReAct diagram 1

The harness underneath a single ReAct step — parse the model output, branch on final versus tool call, validate and run the tool, then splice the result back into the transcript.

ReAct diagram 2

The four ways a ReAct loop derails — looping, hallucinated tools, premature finish, runaway cost — each paired with the guardrail that tames it.

When to use itWhere it fits

  • Agentic tasks requiring live data, like web search or database lookups.
  • Multi-step workflows where the next action depends on prior results.
  • Debugging or troubleshooting flows that need iterative investigation.
  • Building autonomous agents that combine reasoning with tool use.

When NOT to use itLimits & anti-patterns

  • Simple single-call tool use, where a direct function call is faster and simpler.
  • Tasks with no external tools or information needs.
  • Latency-critical applications where multiple reasoning-action loops are too slow.

Trade-offsAdvantages & costs

Advantages
  • Combines reasoning and live tool use in one coherent loop.
  • Adapts mid-task based on real observations, not fixed plans.
  • Improves reliability on tasks needing external information.
  • Forms the backbone of most modern agent frameworks.
Trade-offs & costs
  • Multiple loop iterations add significant latency and cost.
  • Can get stuck in unproductive reasoning-action loops.
  • Harder to debug than a single-shot prompt.
  • Requires careful tool and observation formatting to work reliably.

ExampleIn the real world

Perplexity's answer engine uses a ReAct-style loop, reasoning about what to search, issuing a search action, reading results, and repeating before composing a cited answer.

ToolsHow to implement it

  • LangGraphexplicit state machine for building ReAct-style agent loops.
  • LangChain Agentsoriginal ReAct agent implementation with tool integration.
  • OpenAI function callingstructured action format underlying many ReAct agents.
  • Anthropic tool use APInative support for reasoning plus tool call loops.

Cost & effortWhat it takes

Cost and latency scale with the number of reasoning-action cycles, often three to ten times a single call; needs monitoring to catch runaway loops.

A living map of modern AI — kept current every morning