# AI Agent Design Patterns — Architecture Guide 2026 > Catalog of proven design patterns for building AI agents: ReAct, Plan-and-Execute, Reflection, Tool Use, Multi-Agent, Human-in-the-Loop, and more. With architecture diagrams and code examples. ## Install Paste the prompt below into your AI tool: ## Quick Use Choose your pattern based on task complexity: | Task Type | Pattern | When | |-----------|---------|------| | Simple Q&A with tools | **ReAct** | Most common starting point | | Multi-step projects | **Plan-and-Execute** | Complex tasks needing planning | | Quality-sensitive output | **Reflection** | When first attempt is not enough | | Team-like workflows | **Multi-Agent** | Specialist roles needed | | Production safety | **Human-in-the-Loop** | High-stakes decisions | | Autonomous coding | **Code Agent** | Write and run code | --- ## Intro AI agent systems have evolved from simple prompt-response chains to sophisticated architectures with planning, tool use, reflection, and multi-agent collaboration. This guide catalogs the 8 proven design patterns that power production agent systems in 2026 — from the foundational ReAct loop to advanced multi-agent orchestration. Each pattern includes when to use it, architecture diagrams, and implementation examples. Best for developers designing agent systems who need to choose the right architecture. Works with: any LLM framework. --- ## Pattern 1: ReAct (Reason + Act) The foundational agent pattern. Think, then act, then observe. ``` Loop: 1. Thought: "I need to find the user's order status" 2. Action: call get_order_status(order_id="12345") 3. Observation: "Order shipped, tracking: UPS123" 4. Thought: "I have the answer" 5. Final Answer: "Your order was shipped. Tracking: UPS123" ``` **When**: Single-step tool use, Q&A with data lookup. ```python result = agent.run("What is the status of order 12345?", tools=[get_order_status, search_products]) ``` ## Pattern 2: Plan-and-Execute Separate planning from execution for complex tasks. ``` 1. PLAN: Break task into steps - Step 1: Analyze current database schema - Step 2: Design new tables for feature X - Step 3: Write migration scripts - Step 4: Update API endpoints - Step 5: Add tests 2. EXECUTE: Run each step - [Step 1] Reading schema... done - [Step 2] Designing tables... done - ... 3. REPLAN: Adjust if needed - Step 3 revealed a dependency -> add Step 3.5 ``` **When**: Multi-file code changes, research tasks, project-level work. ## Pattern 3: Reflection Agent reviews and improves its own output. ``` 1. Generate: Write first draft of code 2. Reflect: Review for bugs, edge cases, style 3. Improve: Fix identified issues 4. Reflect again: Check improvements 5. Final: Output polished result ``` **When**: Code generation, writing, any quality-sensitive output. ```python draft = agent.generate(task) critique = agent.reflect(draft, criteria=["correctness", "style", "edge_cases"]) final = agent.improve(draft, critique) ``` ## Pattern 4: Tool Use Agent selects and uses external tools to accomplish tasks. ``` Available tools: - search_web(query) -> results - run_sql(query) -> data - send_email(to, subject, body) - create_file(path, content) Agent decides which tool(s) to call based on the task. ``` **When**: Any task requiring external data or actions. Foundation of most agents. ## Pattern 5: Multi-Agent Multiple specialized agents collaborate. ``` Supervisor Agent -> Research Agent (web search, data gathering) -> Coding Agent (write code, run tests) -> Review Agent (check quality, security) -> Deploy Agent (CI/CD, monitoring) ``` Frameworks: CrewAI, AutoGen, LangGraph, Mastra. **When**: Complex workflows with distinct specialist roles. ## Pattern 6: Human-in-the-Loop Agent pauses for human approval at critical points. ``` Agent: "I plan to delete the old database table. Approve? [Y/N]" Human: "Y" Agent: proceeds with deletion Agent: "I want to send this email to 500 customers. Approve?" Human: "N - change the subject line first" Agent: revises and asks again ``` **When**: Destructive operations, external communications, financial transactions. ## Pattern 7: Code Agent Agent writes and executes code to solve problems. ``` Task: "Analyze this CSV and find outliers" Agent writes Python: import pandas as pd df = pd.read_csv("data.csv") outliers = df[df["value"] > df["value"].mean() + 2*df["value"].std()] print(f"Found {len(outliers)} outliers") Agent executes the code and returns results. ``` Frameworks: Smolagents (Code Agent mode), OpenHands. **When**: Data analysis, math, any task where code is more precise than natural language. ## Pattern 8: Memory-Augmented Agent stores and retrieves memories across sessions. ``` Session 1: "We decided to use PostgreSQL for this project" -> Stored in memory Session 2: "Set up the database" -> Recalls: "We chose PostgreSQL" -> Acts accordingly ``` Tools: Engram, Mem0, CLAUDE.md files. **When**: Long-running projects, personalized assistants, knowledge management. ## Choosing the Right Pattern ``` Simple question + tool? -> ReAct Complex multi-step? -> Plan-and-Execute Quality matters? -> Add Reflection Multiple specialists? -> Multi-Agent Safety critical? -> Add Human-in-the-Loop Data/math heavy? -> Code Agent Cross-session context? -> Memory-Augmented ``` Most production agents combine 2-3 patterns. ### FAQ **Q: Which pattern should I start with?** A: ReAct + Tool Use. It covers 80% of use cases. Add other patterns as needed. **Q: Can I combine patterns?** A: Yes, most production agents use 2-3 patterns. Example: Plan-and-Execute + Reflection + Human-in-the-Loop. **Q: Which frameworks implement these patterns?** A: LangGraph (all patterns), CrewAI (Multi-Agent), AutoGen (Multi-Agent), Smolagents (Code Agent), Claude Code (ReAct + Plan-and-Execute + Tool Use). --- ## Source & Thanks > Synthesized from LangChain, Anthropic, OpenAI, and Microsoft research on agent architectures. > > Related: [CrewAI](https://tokrepo.com), [AutoGen](https://tokrepo.com), [LangGraph](https://tokrepo.com), [Smolagents](https://tokrepo.com), [Engram](https://tokrepo.com) --- ## 快速使用 | 任务类型 | 模式 | |---------|------| | 简单工具调用 | ReAct | | 多步骤项目 | Plan-and-Execute | | 质量敏感 | Reflection | | 团队协作 | Multi-Agent | | 安全关键 | Human-in-the-Loop | | 数据分析 | Code Agent | --- ## 简介 本指南收录 8 种经过验证的 AI Agent 设计模式:ReAct、规划执行、反思、工具使用、多 Agent、人在环路、代码 Agent 和记忆增强。每种模式包含适用场景、架构图和代码示例。适合设计 Agent 系统的开发者选择正确架构。 --- ## 来源与感谢 > 综合自 LangChain、Anthropic、OpenAI 和 Microsoft 的 Agent 架构研究。 --- Source: https://tokrepo.com/en/workflows/958852ab-9d94-415e-91b3-a44c467c4e0a Author: Prompt Lab