0
Act 3

Application

9 / 9

ReAct Pattern

Act 3 · ~4 min

Theory

ReAct (Yao et al., 2023) is the standard pattern for LLM agents. Each iteration has three steps:

StepContentPurpose
ThoughtModel's reasoning in plain textSelects tool + arguments; handles prior errors
ActionOne tool callRetrieves or computes real data
ObservationTool's return valueGrounds the next Thought
Taskuser query
Thoughtreason
Actiontool call
Observationresult
Answer?done or loop
ReAct loop — Thought decides, Action fetches, Observation corrects.

Why it beats alternatives:

  • vs. plain CoT — CoT reasons without external data, so multi-hop factual tasks hallucinate. ReAct Observations are ground truth.
  • vs. blind tool chains — no reasoning between calls means wrong tools get called when earlier steps return unexpected results. Thought handles recovery.

Stopping conditions: final answer produced, or max_steps reached. A hard cap is non-negotiable — an agent looping on a broken tool will exhaust the context window.

Common implementations: LangChain create_react_agent, manual JSON loop with instruction-following models (GPT-4o, Claude 3.5+).