Skip to main content

7. Multi-Agent & A2A

As individual agents mature, the frontier shifts to agent collaboration — how agents communicate, coordinate, and form societies. 2025 saw major standardization efforts with Google's A2A Protocol and the AG-UI Protocol for agent-user interaction.


7.1 Evolution of Multi-Agent Systems​


7.2 A2A Protocol (Google, 2025.4)​

The Agent-to-Agent (A2A) Protocol is Google's open standard for inter-agent communication, announced in April 2025 with support from 50+ companies.

Why A2A Matters​

Problem Without A2ASolution With A2A
Custom integration per agent pairStandard protocol for all
Vendor lock-inOpen, interoperable
No discovery mechanismAgent Cards for capability discovery
Proprietary message formatsStandard JSON-RPC messages
No task lifecycle managementStandardized task states

Core Concepts​

ConceptDescription
Agent CardJSON metadata describing an agent's capabilities, endpoints, and authentication
TaskA unit of work sent from one agent to another with lifecycle management
MessageCommunication within a task (text, files, forms)
PartIndividual content pieces (text, file, data) within a message
Push NotificationAsync notification for long-running tasks

Agent Card Example​

{
"name": "Research Agent",
"description": "Performs web research and synthesizes findings",
"url": "https://research-agent.example.com/a2a",
"capabilities": {
"streaming": true,
"pushNotifications": true
},
"skills": [
{
"id": "web-research",
"name": "Web Research",
"description": "Search and synthesize information from the web"
},
{
"id": "data-analysis",
"name": "Data Analysis",
"description": "Analyze datasets and generate reports"
}
],
"authentication": {
"schemes": ["bearer"]
}
}

Task Lifecycle​

A2A vs MCP​

AspectMCP (Model Context Protocol)A2A (Agent-to-Agent)
PurposeAgent-to-Tool communicationAgent-to-Agent communication
AnalogyUSB for connecting peripheralsHTTP for connecting services
ScopeSingle agent's tool ecosystemMulti-agent collaboration
Transportstdio / SSEHTTP / JSON-RPC
DiscoveryServer-configuredAgent Cards
Created byAnthropic (2024)Google (2025)
RelationshipComplementaryComplementary

7.3 AG-UI Protocol (CopilotKit, 2025)​

The Agent-User Interaction Protocol (AG-UI) standardizes how agents interact with human users through UI components.

Why AG-UI Matters​

Traditional agents return text. AG-UI enables agents to:

  • Render rich UI components (forms, tables, charts)
  • Stream real-time progress indicators
  • Request structured user input
  • Display interactive elements

Architecture​

Event Types​

Event TypeDirectionDescription
TextMessageStart/Content/EndAgent → UIStreaming text output
StateSnapshot / StateDeltaAgent → UIAgent state updates
ToolCallStart/Args/EndAgent → UITool execution progress
ToolCallResultAgent → UITool results
RunStarted / RunFinishedAgent → UILifecycle events

7.4 Real-World Case Study: Docker Agent Fleet (2026)​

Docker 团队在其 Coding Agent Sandboxes(sbx)项目中构建了一个由 7 个 AI Agent 角色组成的 "虚拟团队",用于自动化 CI/CD 流程。这是多 Agent 协作在工程生产中的一个典型落地案例。

核心设计理念​

  • 角色而非脚本:每个 Agent 是一个 SKILL.md 文件,定义角色(persona)、职责和可用工具,而非固定的执行步骤
  • 本地优先,CI 其次:所有 Skill 先在开发者本地验证,确认行为正确后再接入 CI
  • 同一套 Skill,两个运行时:本地终端和 CI 环境运行完全相同的 Skill 文件

七个 Agent 角色​

角色职责
/build-engineer构建二进制文件、容器模板、平台特定构建标志
/project-manager去重发现结果、管理 GitHub Projects、自动化 Triage
/product-owner将 commit 翻译为人类可读的发布说明
/cli-tester探索性测试,52+ 测试场景,14 个测试层级
/performance-tester生命周期耐久性测试、I/O 性能基准
/upgrade-tester四阶段升级回归测试
/software-engineer响应 GitHub issue 标签,自动修复 Bug

关键创新​

  1. PR 自动审查:当有人在 PR 中评论 /cli-tester-review,CI 在 MacOS、Linux、Windows 三个平台上并行运行探索性测试,结果直接作为 PR 评论发布
  2. 去重机制:project-manager 在创建 issue 前会通过 GraphQL 分页扫描整个项目板,避免重复
  3. 渐进式自主性:本地运行时交互式提问,CI 中完全自动模式

来源:Docker Blog - A Virtual Agent team at Docker(2026-05-01)


7.5 Multi-Agent Patterns​

Common Orchestration Patterns​

1. Supervisor Pattern​

A central supervisor agent delegates tasks to specialized workers.

2. Hierarchical Pattern​

Multi-level management with strategic and tactical planning.

3. Mesh / Peer-to-Peer Pattern​

Agents communicate directly without a central coordinator.

4. Debate Pattern​

Multiple agents discuss and reach consensus through structured debate.

Pattern Comparison​

PatternComplexityScalabilityBest For
SupervisorLowMediumTask delegation
HierarchicalMediumHighLarge organizations
MeshHighMediumCreative collaboration
DebateMediumLowQuality improvement

7.5 Agent Society & Swarms​

Self-Organizing Agents​

Agents that dynamically form teams based on task requirements.

Key Concepts​

ConceptDescription
Agent RegistryDirectory of available agents and their capabilities
Dynamic Team FormationAgents self-organize based on task requirements
Task MarketTasks are posted and agents bid to complete them
Reputation SystemTrack agent performance and reliability
Economic ModelToken-based compensation for agent services

When More Is Less:多 Agent 协作何时失效(2026-09)​

arXiv 2609.19759(Rethinking Multi-Agent Collaboration: When More Is Less)系统论证:随着单 Agent 能力(含 harness 质量)持续增强,多 Agent 协作并非总是带来真实增益。论文给出判别"何时多 Agent 有价值"的框架,并指出许多流行多 Agent 模式在强单体基线下收益为负。这与工程社区的实践观察相互印证——OpenAI Codex 工程师 Eric Provencher 曾警告"超过两个并行子 Agent 几乎总是在烧 token 而不提升质量"。

选型启示:在引入多 Agent 拓扑前,先跑强单 Agent + 良好 harness 的基线;多 Agent 的合理场景是任务天然可并行分解、子任务间信息依赖弱、以及需要独立视角交叉验证(如对抗性评审)时。并行度本身不是目标。

来源:arXiv:2609.19759(2026-09-17)

Agensh:把组织智能扩展到 1024 个 Agent(2026-09-22)​

arXiv 2609.26781(Agensh: Scaling Organizational Intelligence to 1,024 Agents)沿"Agent 社会"路线把规模推到四位数:通过分层组织结构让上千个 Agent 协同工作而不失控。这与"When More Is Less"的警告形成有趣对照——规模本身既不是问题也不是答案,组织结构才是:无结构的堆叠 Agent 数量会放大失败模式,而合适的分层与角色设计可以在大规模下保持增益。

与同期 2609.26780(SpeakerMem-R1)合看还有一层启示:多方(多 Agent)协作的记忆瓶颈与人类群聊一致——谁说了什么、对谁说的、群体共享了什么。SpeakerMem 的"说话人标签逐字消息 + 个人/群组双视图"设计对多 Agent 系统的共享记忆同样适用。

来源:arXiv:2609.26781、arXiv:2609.26780(2026-09-22)

7.6 W3C ANP (Agent Network Protocol)​

The W3C is working on standardizing agent networking through the Agent Network Protocol (ANP).

Goals​

  1. Interoperability: Agents from different vendors can communicate
  2. Discovery: Standard mechanism for finding agents
  3. Trust: Verification and reputation systems
  4. Privacy: Data sharing controls
  5. Security: Authentication and authorization

Relationship to Other Standards​

W3C ANP (Agent Network Protocol)
├── Builds on: A2A Protocol (Google)
├── Complements: MCP (Anthropic)
├── Inspired by: AG-UI (CopilotKit)
└── Aligns with: Web Standards (HTTP, JSON-LD)

7.7 Implementation with Agent SDKs​

OpenAI Agents SDK — Multi-Agent Handoff​

from agents import Agent, Runner

researcher = Agent(
name="Researcher",
instructions="You research topics thoroughly.",
)

writer = Agent(
name="Writer",
instructions="You write clear, engaging content.",
)

coordinator = Agent(
name="Coordinator",
instructions="Route tasks to the right specialist.",
handoffs=[researcher, writer],
)

result = Runner.run_sync(coordinator, "Write a report on quantum computing")

LangGraph — Supervisor Pattern​

from langgraph.graph import StateGraph, END
from typing import TypedDict, Annotated
import operator

class State(TypedDict):
messages: Annotated[list, operator.add]
next: str

def supervisor(state: State):
# Decide next agent
return {"next": "researcher"}

def researcher(state: State):
# Research and return findings
return {"messages": ["Research findings..."]}

workflow = StateGraph(State)
workflow.add_node("supervisor", supervisor)
workflow.add_node("researcher", researcher)
workflow.add_conditional_edges("supervisor", lambda s: s["next"])
workflow.add_edge("researcher", "supervisor")
workflow.set_entry_point("supervisor")

app = workflow.compile()

7.8 Multi-Agent 安全与基础设施​

LCGuard:多 Agent 潜在通信安全(2026)​

论文 LCGuard 关注 LLM 多 Agent 系统中一个新兴的安全问题:当 Agent 之间通过 KV Cache(而非自然语言)共享中间状态时,可能产生潜在信道泄露。

核心问题:

  • 多 Agent 系统中,为提高效率开始使用共享 KV Cache 进行通信
  • KV Cache 中可能编码了敏感信息(用户隐私、内部推理过程)
  • 恶意 Agent 可以通过分析 KV Cache 的统计特征推断其他 Agent 的输入

LCGuard 方案:通过在 KV 共享层添加潜在的通信守卫,过滤敏感信息的同时保持协作效率。

来源:arXiv:2605.22786(2026-05)

DeltaBox:毫秒级沙盒检查点/回滚(2026)​

论文 DeltaBox 解决了 LLM Agent 高频状态探索的基础设施问题——为 AI Agent 提供毫秒级的完整沙盒状态检查点和回滚能力。

应用场景:

  • 测试时树搜索(test-time tree search)
  • 强化学习训练中的 episode 回滚
  • Agent 错误恢复和状态探索

技术亮点:基于增量的 C/R 机制,避免了传统虚拟机快照的巨大开销,使 Agent 可以在毫秒级保存和恢复完整的文件系统 + 进程状态。

来源:arXiv:2605.22781(2026-05)


7.9 Key Takeaways​

  1. A2A Protocol is becoming the standard for inter-agent communication
  2. AG-UI Protocol bridges the gap between agents and rich user interfaces
  3. MCP + A2A are complementary — tools vs. agent collaboration
  4. Multi-agent patterns (Supervisor, Hierarchical, Mesh) solve different coordination needs
  5. Agent societies represent the frontier — self-organizing, economic systems

Start with Patterns

Before building multi-agent systems, master the Supervisor pattern — it's the most practical for most use cases. Use LangGraph or OpenAI Agents SDK for implementation.

Protocol Selection
  • Need agent-to-tool communication? Use MCP
  • Need agent-to-agent communication? Use A2A
  • Need agent-to-user rich interaction? Use AG-UI