Skip to main content

ReAct

The agent operates in an explicit loop of Thought (reason about what to do) → Action (call a tool) → Observation (process the result) → repeat. Unlike Chain of Thought, ReAct interleaves reasoning with real-world tool use, grounding the agent's thinking in actual data rather than pure inference.

This is the standard agent loop. Nearly every production agent uses some form of ReAct.


Structure​

The loop continues until the agent decides it has enough information to produce a final answer, or a maximum iteration count is reached. Each cycle grounds the agent's reasoning in real data.


How It Works​

  1. Thought — agent reasons about the current state and what information is needed
  2. Action — agent selects and calls a tool with specific parameters
  3. Observation — tool result is returned and added to the context
  4. Evaluate — agent decides whether to continue (more actions needed) or conclude
  5. Answer — when sufficient information is gathered, agent produces the final response

The key insight: by forcing the agent to think before acting, it makes better tool selection decisions. By observing before thinking again, it grounds subsequent reasoning in reality.


Key Characteristics​

  • Grounded reasoning — each thought is informed by real tool outputs, not just inference
  • Adaptive — the agent can change strategy based on what it discovers
  • Observable — the thought-action-observation trace is a complete audit log
  • Token expensive — each loop iteration adds to the context window
  • Unbounded by default — needs explicit max iterations to prevent runaway loops

When to Use​

  • Tasks require both reasoning and information gathering
  • The agent needs to make decisions based on real-time data (search, APIs, databases)
  • You can't predict upfront what tools or how many steps will be needed
  • Transparency matters — you want to see the agent's reasoning and actions
  • General-purpose agent tasks (coding, research, analysis, troubleshooting)