SuperAPI AI 工具集

a2a-patterns

编程与开发

查看项目

更新于 10-16 00:04

技能介绍

用途:该技能为在 Google Agent Development Kit(ADK)中实现 Agent2Agent(A2A)协议提供成套模式。A2A 用于标准化 AI 智能体之间的通信,支持跨框架与跨平台的多智能体协作,与负责工具/数据连接的 MCP 互补。

主要能力:1)服务端暴露智能体:通过 AgentCard(/.well-known/agent.json)、AgentExecutor、DefaultRequestHandler、A2AStarletteApplication 对外提供 A2A 服务;2)客户端消费外部智能体:用 A2ACardResolver 发现远端能力,用 send_task 工具发送任务并跟踪会话;3)多智能体编排:协调者智能体路由任务,专家智能体处理特定领域,结果聚合;4)Agent Card 配置:定义名称、描述、版本、技能、模态、端点与协议版本;5)协议配置:gRPC 传输(A2A v0.3+)与 Security Card 签名;6)JSON-RPC 2.0 消息格式。

使用方式:技能内含 Python/Go 模板(a2a-server.py、a2a-client.py、multi-agent-orchestration.py、grpc-config.py、security-card.py 等)、配置模板(agent-card.json、deployment-config.yaml、security-policy.json)与脚本,例如 bash scripts/expose-agent.sh --platform cloud-run、bash scripts/consume-agent.sh --url https://remote-agent.example.com、bash scripts/generate-agent-card.sh、bash scripts/validate-a2a.sh --config agent-card.json。依赖安装:pip install google-adk[a2a]、pip install google-cloud-aiplatform、pip install grpcio。

适用场景:研究智能体集群、电商助手、代码审查系统、数据管道等多智能体协作;可部署到 Cloud Run、Agent Engine、GKE,并可与 CrewAI、LangGraph 等框架互操作。

限制:资料未提供具体收费、价格或效果数据;需 GCP 项目与 Vertex AI API、HTTPS 域名等基础设施;密钥须用占位符并置于环境变量,不得硬编码或提交到 git。