SuperAPI AI 工具集

a2a-setup

通用与其它

查看项目

更新于 10-16 08:10

技能介绍

用途:在多台 OpenClaw 服务器之间建立基于 A2A v0.3.0 协议的智能体互信通信通道,支持双向消息收发与长任务轮询,也提供 Tailscale 组网指引。

前提条件:每台服务器需运行 OpenClaw ≥ 2026.3.0,服务器间网络连通(推荐 Tailscale),Node.js ≥ 22。

主要步骤:1)在 <WORKSPACE>/plugins 下克隆 https://github.com/win4r/openclaw-a2a-gateway.git 并执行 npm install --production;2)在 plugins.allow 中加入 a2a-gateway,plugins.load.paths 使用绝对路径,entries.a2a-gateway.enabled 设为 true;3)配置 Agent Card(name、description、url 指向 http://<REACHABLE_IP>:18800/a2a/jsonrpc、skills);4)配置 server.host 与 server.port(默认 18800);5)用 openssl rand -hex 24 生成令牌,security.inboundAuth 设为 bearer 并配置 token;6)设置 routing.defaultAgentId;7)在 peers 数组中添加对端 agentCardUrl、auth 类型与令牌;8)执行 openclaw gateway restart 并用 curl 校验 Agent Card 与对端连通性;9)把模板中的 A2A 段落追加到智能体的 TOOLS.md;10)用 scripts/a2a-send.mjs 做端到端测试。

注意:agentCard.url 指向 JSON-RPC 端点,peers[].agentCardUrl 用于发现对端 Agent Card,两者不可混淆;官方 SDK 默认路径为 /.well-known/agent-card.json。

长任务可用异步模式:--non-blocking --wait --timeout-ms 600000 --poll-ms 1000,先发送 blocking=false 再轮询 tasks/get。仍出现 “no agent dispatch available” 时可增大 config.timeouts.agentResponseTimeoutMs(默认 300000)。

可选:通过 --agent-id 将单次请求路由到特定 agentId(OpenClaw 扩展,非标准字段,JSON-RPC/REST 更可靠,gRPC 可能丢弃该字段)。

双向通信需在两台服务器分别完成步骤 1-9,并互相加入 peers 与令牌,最后各自重启网关验证。

限制与排查:load.paths 必须使用绝对路径;Agent Card 404 通常因插件未加载;端口 18800 拒绝连接需重启网关;对端鉴权失败多为令牌不匹配;智能体不了解 A2A 多为 TOOLS.md 未配置。收费、价格与其它平台信息暂未提供。