← 返回藏书阁

A2A Samples:Agent Card / Discovery / 多框架 agent interoperability

wiki/ai/sources/a2a-samples-agent-card-discovery-interoperability.md
分类:ai / sources · 更新:2026-09-03 09:14

A2A Samples:Agent Card / Discovery / 多框架 agent interoperability

核心结论

A2A Samples 是比协议介绍更有价值的实践样本:它展示了多个 agent 框架如何被暴露成独立 A2A server,host 如何先读取远端 AgentCard,再把用户任务委托给一个或多个 remote agents,并通过 streaming、webform、artifact、图片/文件等内容形态完成协作。它仍是 demo/WIP,不应被当成生产证据;但对 A2A-Agent2Agent-Protocol 来说,它补上了“协议字段如何落到 harness/runtime”的机制证据。^[raw/articles/a2a-samples-agent-card-discovery-interoperability-2026-09-03.md]

深度判断

  • relevance 5/5:直接命中本轮最高优先级 A2A protocol / Agent Card / Agent Discovery / agent-to-agent delegation / multi-agent interoperability。
  • novelty 4/5:已有 wiki 有 A2A 概念页和 ContextForge 控制面页,但还缺少“真实 samples 如何组织 host、remote agent、framework adapter、MCP tool”的实践样本。
  • durability 4/5:A2A 规范可能继续变化,samples 细节会变;但 host-agent / remote-agent / AgentCard / task lifecycle / artifact 的架构边界具有长期参考价值。
  • actionability 4/5:可直接转化为 Hermes 的未来 agent registry 字段、委托边界和不可信 AgentCard 处理规则。
  • source-quality 3/5:来源是官方 GitHub samples,可信但明确标注 demo/WIP;缺少独立部署案例、企业事故或基准结果。
  • depth-potential 5/5:它能把 A2A 从“协议新闻”升级成可评估的 runtime pattern,因此晋升为正式 source 页。

为什么这对用户重要

对 Hermes / llm-wiki 来说,A2A 的关键不是“又多一个协议”,而是 agent 能力面会从本地 tool list 扩展为远端 specialist agents。Samples 中的 CLI host 会读取 server 的 AgentCard,multiagent host 维护一组 Remote Agents,content_creation 展示 Python/Java/TypeScript agents 可替换协作,weather/Airbnb planner 展示 Python agent 与 Java agent 通过 A2A 协作且底层还能调用 MCP server。这意味着未来 Hermes 如果接入研究 agent、代码 agent、发布 agent或企业内部 assistant,不能只记录函数 schema,还要记录 agent card、auth、owner、trust tier、任务生命周期、artifact schema 和 trace receipt。^[raw/articles/a2a-samples-agent-card-discovery-interoperability-2026-09-03.md]

机制 / 一阶原理

A2A Samples 暴露出一个四层模型:

  1. Host / Client 层:CLI、Web Host 或 Orchestrator Agent 作为 A2A client;它不直接知道远端 agent 内部工具,而是通过 URL 读取 AgentCard,然后按能力委托任务。
  2. Discovery / Card 层:AgentCard 是远端 agent 的上下文 manifest。它决定 host 能否发现服务端 endpoint、能力、输入/输出模式、streaming/push 能力与认证要求。
  3. Remote Agent Service 层:LangGraph、AG2、ADK、CrewAI、LlamaIndex、Java/Quarkus、Genkit 等框架都可包成 standalone A2A server;A2A 在这里扮演 framework-neutral service boundary。
  4. Tool / MCP 层:AG2 sample 和 weather/Airbnb planner 显示远端 agent 内部仍可调用 MCP/custom tools。也就是说 A2A 不替代 MCP,而是把“会调用工具的 agent”作为更高阶可委托对象暴露出去。

这个模型和 MCP-Gateway-Runtime 的关系是:MCP gateway 治理 agent-to-tool,A2A registry/gateway 治理 agent-to-agent;一旦二者合并,控制面需要同时处理工具权限、agent 委托权限、跨 agent trace 和 artifact 验证。

对 Hermes / llm-wiki 的可执行启发

  1. Agent registry 字段要从 tool schema 扩展为 AgentCard receipt。 未来如果 Hermes 维护可委托 agents,应保存 card_url、card_hash、provider、endpoint、skills、input/output modes、streaming/push、auth scheme、owner、risk tier、last_verified_at。
  2. 远端 AgentCard 必须当作不可信输入。 A2A CLI README 明确警告外部 agent 的 AgentCard、messages、artifacts、task statuses 都应视为 untrusted input;如果 card 的 description/skills 被拼进 LLM prompt,可能形成 prompt injection。Hermes 的 discovery step 应先做 sanitize/allowlist,再进入模型上下文。^[raw/articles/a2a-samples-agent-card-discovery-interoperability-2026-09-03.md]
  3. Benchmark 要记录委托结构。 Agent-Benchmarks 不应只记录最终成功率,还应记录 host 调了哪些 remote agents、是否读取 AgentCard、是否 streaming、remote agent 是否 opaque、artifact 是否可验证、成本/轨迹如何归因。
  4. A2A 实践案例的入库门槛应更严格。 只说“支持 A2A”的项目不够;应优先入库有 card discovery、host/remote split、任务状态、artifact、auth、trace、MCP/tool 交互或跨语言/跨框架替换证据的案例。

失败模式 / 边界条件

  • Samples 自身标注为 demo/WIP,因此不能推断生产可靠性、安全性或企业采用程度。
  • AgentCard discovery 会把远端描述注入上游上下文;如果没有 sanitization,就会形成 supply-chain prompt injection。
  • Host agent 可能过度信任 remote agent 的自然语言结果;缺少 artifact hash、tool-call receipt 或 independent verifier 时,委托只是在扩大 opaque surface。
  • 多语言/多框架 interoperability 解决“能连上”的问题,不自动解决责任归属、预算、权限、数据脱敏和审计保留。
  • A2A + MCP 组合会叠加风险:远端 agent 既可被委托,又能调用自己的 MCP tools;上游必须限制 delegation scope 与 data release policy。

与既有 wiki 概念的关系

  • A2A-Agent2Agent-Protocol:本页是其官方 samples/practice 补充,把 Agent Card、Discovery、task lifecycle、streaming/push 从概念落到 demo harness。
  • MCP-Gateway-Runtime:补充 agent-to-agent federation 维度,尤其是远端 agent 内部再调用 MCP tools 的组合形态。
  • Harness-Engineering:A2A host/remote split 本质上是 harness boundary;应有可测试的 task lifecycle、artifact 和 trace contract。
  • Agent-Benchmarks:提示 benchmark 需要把 delegation topology 和 remote-agent opacity 纳入评分。
  • Context-Engineering:AgentCard 是可执行上下文,而不是说明文字;需要版本、hash 和安全过滤。

写入记录

  • 2026-09-03 09:00 CST:基于 a2aproject/A2A 与 a2aproject/a2a-samples 多个 README 组合归档并新建 source 页,提炼 A2A samples 对 Agent Card、Discovery、host/remote split、MCP 组合与 Hermes agent registry 的启发。