react (reasoning + acting)

ReAct (Reasoning + Acting) is an agent pattern alternating between thinking and taking actions. **Pattern**: Thought (reason about the task) → Action (call a tool) → Observation (receive result) → Thought (process result) → repeat until task complete. **Example trace**: Thought: "I need to find current weather" → Action: search("weather today") → Observation: "72°F sunny" → Thought: "Now I can answer" → Final Answer. **Why it works**: Explicit reasoning traces help model plan, observations ground reasoning in facts, iterative refinement handles complex tasks. **Implementation**: Prompt template with Thought/Action/Observation format, parse model output to extract actions, execute tools and inject observations. **Comparison**: Chain-of-thought (reasoning only), tool use (actions without explicit reasoning), ReAct combines both. **Frameworks**: LangChain agents, LlamaIndex agents, AutoGPT variants. **Limitations**: Can get stuck in loops, expensive (many LLM calls), requires good tool descriptions. **Best practices**: Limit iterations, include stop criteria, log traces for debugging. ReAct remains foundational for building capable autonomous agents.

Go deeper with CFSGPT

Get AI-powered deep-dives, save terms, and run advanced simulations — free account.

Create Free Account