A2A Gateway Setup
Configure the Claw Crony A2A Gateway plugin for cross-server agent-to-agent communication using the A2A v0.3.0 protocol.
Prerequisites
- - OpenClaw ≥ 2026.3.0 installed and running on each server
- Network connectivity between servers (Tailscale recommended, LAN or public IP also work)
- Node.js ≥ 22
Step 1: Install the Plugin
CODEBLOCK0
Replace <WORKSPACE> with the agent workspace path. Find it with:
CODEBLOCK1
Step 2: Register Plugin in OpenClaw
Get current allowed plugins first to avoid overwriting:
CODEBLOCK2
Then add claw-crony to the existing array (do NOT drop existing plugin ids):
CODEBLOCK3
Critical: Use the absolute path in plugins.load.paths. Relative paths will fail.
Step 3: Configure Agent Card
CODEBLOCK4
URL field rules
| Field | Points to | Example |
|---|
| INLINECODE3 | JSON-RPC endpoint (default) | INLINECODE4 |
| INLINECODE5 |
Agent Card discovery (preferred) |
http://100.x.x.x:18800/.well-known/agent-card.json |
Do NOT confuse these two. agentCard.url tells peers where to send messages. agentCardUrl tells you where to discover the peer.
Note: this plugin also serves the legacy alias /.well-known/agent.json, but the official SDK default is /.well-known/agent-card.json.
Step 4: Configure Server
CODEBLOCK5
Step 5: Configure Security
CODEBLOCK6
Share this token with peers who need to send you messages.
Step 6: Configure Routing
CODEBLOCK7
Step 7: Add Peers
CODEBLOCK8
For multiple peers, include all in one JSON array.
Step 8: Restart and Verify
CODEBLOCK9
Step 9: Configure TOOLS.md
This step is critical. Without it, the agent won't know how to use A2A.
Read references/tools-md-template.md and append the A2A section to the agent's TOOLS.md, replacing placeholders with actual peer info.
For outbound messaging, use the SDK script (scripts/a2a-send.mjs).
To use the SDK script, ensure @a2a-js/sdk is installed in the plugin directory:
CODEBLOCK10
Step 10: End-to-End Test
CODEBLOCK11
The script uses @a2a-js/sdk ClientFactory to auto-discover the Agent Card, handle authentication, and print the peer agent's response.
Async task mode (recommended for long-running prompts)
For prompts that may take longer than a typical request timeout (e.g., multi-round discussions, long summaries), use non-blocking mode + polling:
CODEBLOCK12
This sends configuration.blocking=false and then polls tasks/get until the task reaches a terminal state.
Server-side timeout configuration (OpenClaw dispatch)
If you still see Request accepted (no agent dispatch available), the underlying OpenClaw agent run may be timing out. Increase:
- -
plugins.entries.claw-crony.config.timeouts.agentResponseTimeoutMs (default: 300000)
Optional: Route to a specific OpenClaw agentId (OpenClaw extension)
By default, the peer will route inbound A2A messages to routing.defaultAgentId.
To route a single request to a specific agentId (e.g., coder) on the peer, pass --agent-id:
CODEBLOCK13
Note: this uses a non-standard message.agentId field understood by the Claw Crony A2A Gateway plugin. It is most reliable over JSON-RPC/REST. gRPC transport may drop unknown Message fields.
Network: Tailscale Setup (if needed)
When servers are on different networks, use Tailscale:
CODEBLOCK14
Use Tailscale IPs in all A2A configuration. Verify with:
CODEBLOCK15
Mutual Peering Checklist
For two-way communication, repeat Steps 1-9 on BOTH servers:
- - [ ] Server A: plugin installed, Agent Card configured, token generated
- [ ] Server B: plugin installed, Agent Card configured, token generated
- [ ] Server A: has Server B in peers (with B's token)
- [ ] Server B: has Server A in peers (with A's token)
- [ ] Server A: TOOLS.md updated with Server B peer info
- [ ] Server B: TOOLS.md updated with Server A peer info
- [ ] Both:
openclaw gateway restart done - [ ] Both: Agent Cards accessible (
curl /.well-known/agent-card.json) - [ ] Test: A → B message/send works
- [ ] Test: B → A message/send works
Troubleshooting
| Symptom | Cause | Fix |
|---|
| "no agent dispatch available" | (1) No AI provider configured, or (2) OpenClaw agent dispatch timed out | Check openclaw config get auth.profiles; for long prompts use async mode (--non-blocking --wait) or increase INLINECODE28 |
| "plugin not found: claw-crony" |
Load path missing or wrong | Verify
plugins.load.paths uses absolute path |
| Agent Card 404 | Plugin not loaded | Check
plugins.allow includes
claw-crony |
| Port 18800 connection refused | Gateway not restarted | Run
openclaw gateway restart |
| Peer auth fails | Token mismatch | Verify peer config token matches target's
security.token |
| Agent doesn't know about A2A | TOOLS.md not configured | Add A2A section from the template (Step 9) |
A2A 网关设置
使用 A2A v0.3.0 协议配置 Claw Crony A2A 网关插件,实现跨服务器的智能体间通信。
前提条件
- - 每台服务器上已安装并运行 OpenClaw ≥ 2026.3.0
- 服务器之间的网络连通性(推荐使用 Tailscale,局域网或公网 IP 也可用)
- Node.js ≥ 22
步骤 1:安装插件
bash
mkdir -p <工作目录>/plugins
cd <工作目录>/plugins
git clone https://github.com/ccccl8/claw-crony.git claw-crony
cd claw-crony
npm install --production
将 <工作目录> 替换为智能体工作空间路径。可通过以下命令查找:
bash
openclaw config get agents.defaults.workspace
步骤 2:在 OpenClaw 中注册插件
首先获取当前允许的插件列表,避免覆盖:
bash
openclaw config get plugins.allow
然后将 claw-crony 添加到现有数组中(不要删除现有插件 ID):
bash
仅作示例——请同时包含您现有的插件
openclaw config set plugins.allow [<现有插件...>, claw-crony]
openclaw config set plugins.load.paths [<绝对路径>/plugins/claw-crony]
openclaw config set plugins.entries.claw-crony.enabled true
关键点: 在 plugins.load.paths 中使用绝对路径。相对路径会导致失败。
步骤 3:配置智能体卡片
bash
openclaw config set plugins.entries.claw-crony.config.agentCard.name <智能体名称>
openclaw config set plugins.entries.claw-crony.config.agentCard.description <描述>
openclaw config set plugins.entries.claw-crony.config.agentCard.url http://<可达IP>:18800/a2a/jsonrpc
openclaw config set plugins.entries.claw-crony.config.agentCard.skills [{id:chat,name:chat,description:将聊天/消息桥接到 OpenClaw 智能体}]
URL 字段规则
| 字段 | 指向 | 示例 |
|---|
| agentCard.url | JSON-RPC 端点(默认) | http://100.x.x.x:18800/a2a/jsonrpc |
| peers[].agentCardUrl |
智能体卡片发现(推荐) | http://100.x.x.x:18800/.well-known/agent-card.json |
不要混淆这两者。 agentCard.url 告诉对等节点消息发送位置。agentCardUrl 告诉您对等节点的发现位置。
注意:此插件也提供旧版别名 /.well-known/agent.json,但官方 SDK 默认使用 /.well-known/agent-card.json。
步骤 4:配置服务器
bash
openclaw config set plugins.entries.claw-crony.config.server.host 0.0.0.0
openclaw config set plugins.entries.claw-crony.config.server.port 18800
步骤 5:配置安全设置
bash
TOKEN=$(openssl rand -hex 24)
echo 保存此令牌:$TOKEN
openclaw config set plugins.entries.claw-crony.config.security.inboundAuth bearer
openclaw config set plugins.entries.claw-crony.config.security.token $TOKEN
将此令牌分享给需要向您发送消息的对等节点。
步骤 6:配置路由
bash
openclaw config set plugins.entries.claw-crony.config.routing.defaultAgentId main
步骤 7:添加对等节点
bash
openclaw config set plugins.entries.claw-crony.config.peers [
{
name: <对等节点名称>,
agentCardUrl: http://<对等节点IP>:18800/.well-known/agent-card.json,
auth: {
type: bearer,
token: <对等节点入站令牌>
}
}
]
对于多个对等节点,将所有节点包含在一个 JSON 数组中。
步骤 8:重启并验证
bash
openclaw gateway restart
验证智能体卡片
curl -s http://localhost:18800/.well-known/agent-card.json | python3 -m json.tool
验证对等节点连通性
curl -s http://<对等节点IP>:18800/.well-known/agent-card.json | python3 -m json.tool
步骤 9:配置 TOOLS.md
此步骤至关重要。 否则智能体将不知道如何使用 A2A。
阅读 references/tools-md-template.md,将 A2A 部分附加到智能体的 TOOLS.md 中,将占位符替换为实际对等节点信息。
对于出站消息,请使用 SDK 脚本(scripts/a2a-send.mjs)。
要使用 SDK 脚本,请确保在插件目录中安装了 @a2a-js/sdk:
bash
cd <工作目录>/plugins/claw-crony && npm ls @a2a-js/sdk
步骤 10:端到端测试
bash
node <工作目录>/plugins/claw-crony/skill/scripts/a2a-send.mjs \
--peer-url http://<对等节点IP>:18800 \
--token <对等节点令牌> \
--message 你好,你叫什么名字?
该脚本使用 @a2a-js/sdk 的 ClientFactory 自动发现智能体卡片、处理身份验证,并打印对等智能体的响应。
异步任务模式(推荐用于长时间运行的提示)
对于可能需要超过典型请求超时时间的提示(例如多轮讨论、长摘要),请使用非阻塞模式加轮询:
bash
node <工作目录>/plugins/claw-crony/skill/scripts/a2a-send.mjs \
--peer-url http://<对等节点IP>:18800 \
--token <对等节点令牌> \
--non-blocking \
--wait \
--timeout-ms 600000 \
--poll-ms 1000 \
--message 分3轮讨论A2A优势并提供最终结论
这会发送 configuration.blocking=false,然后轮询 tasks/get 直到任务达到终止状态。
服务器端超时配置(OpenClaw 调度)
如果仍然看到请求已接受(无智能体调度可用),则底层 OpenClaw 智能体运行可能超时。请增加:
- - plugins.entries.claw-crony.config.timeouts.agentResponseTimeoutMs(默认值:300000)
可选:路由到特定 OpenClaw agentId(OpenClaw 扩展)
默认情况下,对等节点会将入站 A2A 消息路由到 routing.defaultAgentId。
要将单个请求路由到对等节点上的特定 agentId(例如 coder),请传递 --agent-id:
bash
node <工作目录>/plugins/claw-crony/skill/scripts/a2a-send.mjs \
--peer-url http://<对等节点IP>:18800 \
--token <对等节点令牌> \
--agent-id coder \
--message 运行测试并总结失败情况
注意:这使用了 Claw Crony A2A 网关插件理解的非标准 message.agentId 字段。在 JSON-RPC/REST 上最可靠。gRPC 传输可能会丢弃未知的 Message 字段。
网络:Tailscale 设置(如需)
当服务器位于不同网络时,请使用 Tailscale:
bash
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up
通过打印的 URL 进行身份验证(所有服务器使用同一账户)
tailscale ip -4 # 获取 100.x.x.x IP
在所有 A2A 配置中使用 Tailscale IP。通过以下命令验证:
bash
ping <其他服务器TailscaleIP>
双向对等检查清单
对于双向通信,在两台服务器上重复步骤 1-9:
- - [ ] 服务器 A:插件已安装,智能体卡片已配置,令牌已生成
- [ ] 服务器 B:插件已安装,智能体卡片已配置,令牌已生成
- [ ] 服务器 A:对等节点中包含服务器 B(使用 B 的令牌)
- [ ] 服务器 B:对等节点中包含服务器 A(使用 A 的令牌)
- [ ] 服务器 A:TOOLS.md 已更新服务器 B 的对等节点信息
- [ ] 服务器 B:TOOLS.md 已更新服务器 A 的对等节点信息
- [ ] 两台服务器:已执行 openclaw gateway restart
- [ ] 两台服务器