← Back to docs
Recipe

ReAct Agent Pattern

Reason + Act — the foundational loop for tool-calling agents that think before they execute.

ReAct interleaves reasoning traces with action steps. The model generates a thought, decides which tool to invoke, observes the result, and repeats until it can produce a final answer. This grounds every action in explicit chain-of-thought.

The Loop

  1. Thought — analyze the query and plan the next step
  2. Action — select and invoke a tool with structured input
  3. Observation — ingest the tool output into context
  4. Repeat — loop until a final answer is ready

Why it matters

Without reasoning traces, tool-calling agents become brittle — they invoke tools blindly and struggle to recover from errors. ReAct makes the agent's decision process transparent, debuggable, and self-correcting. Every observation feeds back into the next thought, creating a tight feedback loop.

When to use it

  • Multi-step research tasks that require web search, code execution, or database queries
  • Agents that must verify their own outputs before responding
  • Any workflow where tool selection depends on intermediate results
Meridian tip: Combine ReAct with structured output schemas to enforce valid tool calls on every action step.