Guide

代理 AI 架构

如何构建代理 AI:支撑 LLM 驱动系统的架构模式。监督者、协调者-工作者、增强型 LLM、交接、决策日志等。

代理 AI 架构是对“这是什么样的系统?”的结构性回答。单独的 LLM 是一个生成器;而代理是一个决定下一步做什么的生成器,保持状态,与工具交互,交接给其他代理,并且足够可观察,以便人类可以进行干预。架构是一组承诺,使所有这些事情能够发生而不发生冲突。

这些承诺来自模式,而不是单一的图表。监督者与协调者-工作者的架构与群体并不相同;带有步骤预算和决策日志的 ReAct 循环与计划后执行并不相同。目录为您提供了精确区分的词汇 — 并在利益相关者询问“你为什么这样构建?”时为其辩护。

Field-tested patterns to start with

  • SupervisorPlace a coordinating agent above a set of specialised agents and route work to them.
  • Orchestrator-WorkersAn orchestrator dynamically breaks a task into subtasks at runtime and delegates each to a worker LLM, then synthesises results.
  • Augmented LLMBuild the foundational agent block as an LLM augmented with retrieval, tools, and memory that the model actively chooses to use, rather than a bare-model call.
  • ReActInterleave a single thought, a single tool call, and a single observation per step so the agent reasons over fresh evidence.
  • Plan-and-ExecutePlan all the steps once with a strong model, then execute each step with a cheaper model under the plan.
  • HandoffTransfer the active conversation from one agent to another, carrying context across the switch.
  • Subagent IsolationRun subagents in isolated workspaces so their writes do not collide and parallelism is safe.
  • Decision LogPersist the agent's reasoning trace alongside its actions so post-hoc review can explain why.
  • Agent ResumptionPersist agent execution state so a long-running run survives restarts, deploys, or user disconnects.
  • Step BudgetCap the number of tool calls or loop iterations the agent is allowed within a single request.

Recommended reading

Or open the full contents for all 562 patterns in 14 books.

Related guides

  • AI Agents PatternsAI agents patterns: named, reusable shapes for building AI agents that reason, use tools, coordinate, and stay safe — single-agent loops an…
  • AI Agents Patterns CatalogThe AI agents patterns catalog: a complete, GoF-formal pattern language for AI agents across reasoning, planning, tool use, retrieval, memo…
  • LLM Agent Design PatternsA GoF-formal catalog of LLM agent design patterns: ReAct, tool use, plan-and-execute, reflection, step budget, and more. Each pattern decom…
  • Agentic Design PatternsA GoF-formal catalog of agentic design patterns — named, reusable shapes for building autonomous AI agents: agent loops, tool use, planning…
  • Agentic AI Design PatternsAgentic AI design patterns for systems already in production — what to ship, what to observe, what to budget, what to gate. Augmented LLM,…
  • AI Agent Design PatternsHow to build an AI agent: the named shapes you reach for during design and implementation — reasoning (ReAct, plan-and-execute, reflection)…
  • Agent Design PatternsAgent design patterns treat the agent loop as a software-engineering primitive: an observe→reason→act cycle wrapped in tools, memory, super…
  • Agentic PatternsA complete pattern language for agentic systems, organised in Alexander-style books across reasoning, planning, tool use, retrieval, verifi…
  • RAG Agent PatternsPatterns for building retrieval-augmented generation agents: naive RAG, agentic RAG, hybrid search, cross-encoder reranking, contextual ret…
  • Multi-Agent PatternsPatterns for coordinating multiple LLM agents: supervisor, orchestrator-workers, handoff, debate, hierarchical agents, swarm, role assignme…
  • AI Agent Safety PatternsSafety patterns for LLM agents: step budget, kill switch, constitutional charter, approval queue, sandbox isolation, input/output guardrail…

About this catalog

The Agent Patterns Catalog is an open, GoF-formal reference of 562 design patterns for building LLM agents. Each pattern is decomposed in the manner of Christopher Alexander (1977) and the Gang of Four (1994). Source of truth at github.com/agentpatternscatalog/patterns — CC BY 4.0.

Open the contents