ReAct (Reason + Act) is a prompting pattern that interleaves reasoning (Thought), tool execution (Action), and observation (Observation) in an iterative loop. The model reasons about what to do, executes a tool, observes the result, and reasons again. This enables LLMs to use external tools (search, calculators, code execution, APIs) to solve problems beyond their training data. ReAct is the foundation of most LLM agent frameworks (LangGraph, AutoGen, OpenAI Assistants).
Each stage in order — click any step to read what it does.
The ReAct Thought-Action-Observation loop.
The trade-offs worth knowing before you build this.
Without the Thought step, models call tools with incorrect parameters or in wrong order. The Thought step forces the model to plan before acting — fewer wasted tool calls, lower cost.
ReAct loops can iterate indefinitely if the model cannot make progress. Set max_iterations=10 and max_execution_time=60s. Return partial results with an explanation rather than running forever.
Old ReAct used string parsing to extract Action: search and Action Input: query. Modern LLM APIs (OpenAI tools, Claude tool_use) return structured JSON tool calls — no regex, fully typed, reliable.
Sign in to share your feedback and join the discussion.