{
  "slug": "agent-reasoning-patterns",
  "title": "Agent Reasoning and Design Patterns",
  "description": "The canonical single-agent reasoning and acting loops: ReAct, Chain-of-Thought, Plan-and-Solve, ReWOO, Reflexion, Tree-of-Thoughts, and Self-Consistency — what each is, when to use it, and tradeoffs.",
  "category": "Guide",
  "tags": [
    "agents",
    "reasoning",
    "react",
    "chain-of-thought",
    "planning",
    "reflection",
    "patterns"
  ],
  "updated": "2026-07-16",
  "premium": false,
  "canonical": "https://changegamer.ai/resources/agent-reasoning-patterns",
  "markdown": "https://changegamer.ai/resources/agent-reasoning-patterns.md",
  "outline": [
    {
      "depth": 2,
      "text": "The core loop",
      "anchor": "the-core-loop"
    },
    {
      "depth": 2,
      "text": "Named patterns",
      "anchor": "named-patterns"
    },
    {
      "depth": 3,
      "text": "ReAct — reason + act interleaved",
      "anchor": "react-reason-act-interleaved"
    },
    {
      "depth": 3,
      "text": "Chain-of-Thought (CoT)",
      "anchor": "chain-of-thought-cot"
    },
    {
      "depth": 3,
      "text": "Plan-and-Execute / Plan-and-Solve",
      "anchor": "plan-and-execute-plan-and-solve"
    },
    {
      "depth": 3,
      "text": "ReWOO — reasoning without observation",
      "anchor": "rewoo-reasoning-without-observation"
    },
    {
      "depth": 3,
      "text": "Reflexion — self-reflection and retry",
      "anchor": "reflexion-self-reflection-and-retry"
    },
    {
      "depth": 3,
      "text": "Tree-of-Thoughts (ToT)",
      "anchor": "tree-of-thoughts-tot"
    },
    {
      "depth": 3,
      "text": "Self-Consistency",
      "anchor": "self-consistency"
    },
    {
      "depth": 2,
      "text": "Tool-use and stopping",
      "anchor": "tool-use-and-stopping"
    },
    {
      "depth": 2,
      "text": "Reliability techniques",
      "anchor": "reliability-techniques"
    },
    {
      "depth": 2,
      "text": "Decision guide",
      "anchor": "decision-guide"
    },
    {
      "depth": 2,
      "text": "Verified sources",
      "anchor": "verified-sources"
    }
  ],
  "related": [
    {
      "slug": "multi-agent-orchestration-patterns",
      "title": "Multi-Agent Orchestration Patterns",
      "description": "Vendor-neutral reference covering when multi-agent systems pay off and nine named patterns — from single-agent baseline through hierarchical and blackboard architectures — with tradeoffs, cross-cutting concerns, and a decision guide.",
      "url": "https://changegamer.ai/resources/multi-agent-orchestration-patterns"
    },
    {
      "slug": "prompt-context-engineering",
      "title": "Prompt and Context Engineering for Agents",
      "description": "From crafting a single prompt to managing everything an agent sees across a trajectory: system-prompt design, context-window management, failure modes, and a high-leverage checklist.",
      "url": "https://changegamer.ai/resources/prompt-context-engineering"
    },
    {
      "slug": "prompt-injection-design-patterns",
      "title": "Prompt Injection Design Patterns: Architectural Defenses for Agents",
      "description": "Six named architectural patterns — Action-Selector, Plan-Then-Execute, LLM Map-Reduce, Dual LLM, Code-Then-Execute, Context-Minimization — plus Google DeepMind's CaMeL, that structurally constrain what an agent can do with untrusted data instead of just filtering it.",
      "url": "https://changegamer.ai/resources/prompt-injection-design-patterns"
    },
    {
      "slug": "agent-cost-latency-optimization",
      "title": "Agent Cost and Latency Optimization",
      "description": "Practitioner reference for reducing the cost and latency of production AI agents: the compounding model, token-level levers (caching, pruning), request-level levers (Batch API, parallelism), model-level levers (routing, reasoning-effort controls), and architecture-level levers (step reduction, semantic caching, code offloading).",
      "url": "https://changegamer.ai/resources/agent-cost-latency-optimization"
    }
  ],
  "furtherReading": [
    {
      "slug": "acp-vs-ap2-vs-x402",
      "title": "ACP vs. AP2 vs. x402: Which Agent Payment Rail Should You Implement?",
      "description": "A decision framework for choosing between ACP, AP2, and x402 (plus the self-hosted 402 gate) — sorted by who your buyer actually is, what you are selling, and what is live versus waitlisted today.",
      "url": "https://changegamer.ai/articles/acp-vs-ap2-vs-x402"
    },
    {
      "slug": "agent-checkout-vs-human-checkout",
      "title": "Agent Checkout vs. Human Checkout: Why Your Payment Flow Fails Machine Buyers",
      "description": "Why checkout built for a person watching a screen is unusable by an AI agent, and what a checkout flow that actually completes for a machine buyer looks like — 402 + API key versus native x402.",
      "url": "https://changegamer.ai/articles/agent-checkout-vs-human-checkout"
    }
  ],
  "body": "Every agent implementation rests on the same substrate: a loop that perceives input, reasons about what to do, executes an action (usually a tool call), observes the result, and repeats until a termination condition is met. The named patterns below are systematic ways of structuring that loop. Choose the simplest pattern that meets your correctness and cost requirements.\n\n## The core loop\n\n**Perceive → Reason → Act → Observe → repeat.**\n\nEach turn the agent reads its context window (system prompt, history, tool results), produces reasoning or a plan, calls a tool or returns a final answer, and appends the result to context. Two decisions recur in every pattern: (1) *which tool to call* (driven by the reasoning step and the available tool schema); (2) *when to stop* (goal-satisfaction check, max-iteration guard, or explicit DONE signal). Error recovery follows a retry-then-replan ladder: retry the same call on transient failures, replan on semantic failures, escalate to the caller on persistent failures.\n\n## Named patterns\n\n### ReAct — reason + act interleaved\n\nThe model emits a *Thought* (free-form reasoning trace), then an *Action* (tool call), then an *Observation* (tool result), cycling until it can emit a final answer. Interleaving reasoning with actions keeps the scratchpad grounded: each thought is informed by the most recent real observation. **When to use:** general-purpose tool-using agents, short-to-medium horizon tasks. **Tradeoff:** reasoning tokens paid on every turn; long loops accumulate context fast.\n\n### Chain-of-Thought (CoT)\n\nThe model reasons step-by-step in natural language before producing an answer, without interleaved tool calls. Strong for arithmetic, logic, and multi-step inference when all information is already in context. **Limit:** no mechanism to retrieve missing information or recover from wrong intermediate steps. **Reasoning-native models** (OpenAI's o-series, Claude's extended thinking, Gemini's thinking variants) generate this step-by-step trace internally as part of inference, so explicitly prompting \"think step by step\" is often redundant and can degrade output on these models — prefer concise, direct prompts and let the model's built-in reasoning run (WebSearch-convergence across multiple vendor prompting guides, as of mid-2026). Explicit CoT prompting still applies to non-reasoning/base chat models.\n\n### Plan-and-Execute / Plan-and-Solve\n\nPhase 1: produce an explicit multi-step plan. Phase 2: execute each step, optionally re-planning when a step fails. Separating planning from execution lets the agent reason globally before committing to actions. **When to use:** long-horizon tasks where the full sequence of steps can be enumerated upfront. **Tradeoff:** plan may go stale if early steps produce unexpected results; requires a replanning trigger.\n\n### ReWOO — reasoning without observation\n\nAll tool calls are planned upfront in a single reasoning pass, with placeholders for their outputs. The planner runs once; an executor runs the tool calls in sequence, substituting real results for placeholders; a solver synthesizes the final answer. Because the LLM is not re-invoked between tool calls, token consumption is dramatically lower for deterministic tool sequences. **When to use:** tasks with predictable, independent tool calls. **Tradeoff:** cannot adapt mid-sequence if an early result changes what later calls should be.\n\n### Reflexion — self-reflection and retry\n\nAfter a failed or low-quality attempt, the agent critiques its own output in natural language (\"verbal reinforcement\"), stores the critique in an episodic memory buffer, and retries with that critique in context. No weight updates are required — the feedback loop is entirely in-context. **When to use:** tasks with a verifiable success signal (unit tests, factual checks) where correctness matters more than token cost. **Tradeoff:** multiple full attempts multiply cost; critique quality depends on the model's self-awareness.\n\n### Tree-of-Thoughts (ToT)\n\nAt each step, the agent generates multiple candidate reasoning branches, scores or votes on them, and searches the tree (BFS or DFS) for the most promising path. Generalizes Chain-of-Thought from a single chain to a search over reasoning. **When to use:** problems requiring deliberate exploration where greedy reasoning routinely fails (planning puzzles, creative tasks with many candidate solutions). **Tradeoff:** compute cost scales with branching factor and depth; impractical for latency-sensitive tasks.\n\n### Self-Consistency\n\nSample multiple independent reasoning paths (temperature > 0), then select the answer that appears most often across paths (majority vote). No tree search or explicit scoring — diversity is obtained by sampling, consistency is the signal. **When to use:** arithmetic and commonsense reasoning where a correct answer is unique and verifiable. **Tradeoff:** cost scales linearly with the number of samples; diminishing returns beyond ~10–20 paths.\n\n## Tool-use and stopping\n\n- **Tool selection:** driven by the tool schema in the system prompt; structured output (JSON function-call format) reduces mis-calls. See /resources/reliable-tool-calling.\n- **Termination:** explicit DONE / final-answer token, goal-satisfaction check in code, or max-iteration guard (always set one to prevent runaway loops).\n- **Error recovery ladder:** (1) retry identical call on transient/network errors; (2) replan the current step on semantic errors; (3) escalate to the caller on persistent failures. Log every failure with its tool name and arguments.\n\n## Reliability techniques\n\n- **Explicit planning** reduces mid-sequence confusion on long-horizon tasks.\n- **Structured scratchpads** (labeled Thought / Action / Observation blocks) prevent the model from conflating reasoning with output.\n- **Verification / self-check steps** after each action ground the agent in what actually happened, not what it expected.\n- **Grounding in tool results** means: never reason forward from an assumed tool output; always wait for the real observation.\n- More reasoning steps cost more tokens and add latency — see /resources/agent-cost-latency-optimization.\n- Pattern choice interacts with how you structure the system prompt and history — see /resources/prompt-context-engineering.\n\n## Decision guide\n\n1. **Start with ReAct + well-typed tools.** It covers the majority of tool-using tasks with minimal complexity. Add structured output / function-calling format to reduce mis-calls.\n2. **Add explicit planning** (Plan-and-Execute or ReWOO) when the task is long-horizon and the step sequence is predictable.\n3. **Add reflection / verification** (Reflexion, self-check steps) when correctness matters more than cost and a success signal exists.\n4. **Use self-consistency or ToT** only when single-pass reasoning demonstrably fails on your task and you can afford the compute.\n5. **Escalate to multi-agent** only when a single agent genuinely cannot hold the required context, tools, or specialization — see /resources/multi-agent-orchestration-patterns.\n\nCross-links: /resources/reliable-tool-calling · /resources/evaluating-ai-agents · /resources/agent-cost-latency-optimization · /resources/prompt-context-engineering · /resources/multi-agent-orchestration-patterns\n\n## Verified sources\n\n- ReAct (arXiv:2210.03629) — Yao et al., \"ReAct: Synergizing Reasoning and Acting in Language Models\", 2022: https://arxiv.org/abs/2210.03629\n- Reflexion (arXiv:2303.11366) — Shinn et al., \"Reflexion: Language Agents with Verbal Reinforcement Learning\", NeurIPS 2023: https://arxiv.org/abs/2303.11366\n- Tree-of-Thoughts (arXiv:2305.10601) — Yao et al., \"Tree of Thoughts: Deliberate Problem Solving with Large Language Models\", NeurIPS 2023: https://arxiv.org/abs/2305.10601\n- ReWOO (arXiv:2305.18323) — Xu et al., \"ReWOO: Decoupling Reasoning from Observations for Efficient Augmented Language Models\", 2023: https://arxiv.org/abs/2305.18323\n- Self-Consistency (arXiv:2203.11171) — Wang et al., \"Self-Consistency Improves Chain of Thought Reasoning in Language Models\", 2022: https://arxiv.org/abs/2203.11171\n- Plan-and-Solve (arXiv:2305.04091) — Wang et al., \"Plan-and-Solve Prompting: Improving Zero-Shot Chain-of-Thought Reasoning by Large Language Models\", ACL 2023: https://arxiv.org/abs/2305.04091",
  "sources": [
    "https://arxiv.org/abs/2210.03629",
    "https://arxiv.org/abs/2303.11366",
    "https://arxiv.org/abs/2305.10601",
    "https://arxiv.org/abs/2305.18323",
    "https://arxiv.org/abs/2203.11171",
    "https://arxiv.org/abs/2305.04091"
  ]
}