返回顶部
a

a2a-setupA2A网关配置

Install and configure the Claw Crony A2A Gateway plugin for cross-server agent communication. Use when: (1) setting up A2A between two or more OpenClaw instances, (2) user says 'configure A2A', 'set up A2A gateway', 'connect two OpenClaw servers', 'agent-to-agent communication', (3) adding a new A2A peer to an existing setup. Covers: plugin installation, Agent Card configuration, security tokens, peer registration, network setup (Tailscale/LAN), TOOLS.md template for agent awareness, and end-to-

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.2
安全检测
已通过
101
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

a2a-setup

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.urlJSON-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
  • [ ] 两台服务器

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 claw-crony-1776020238 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 claw-crony-1776020238 技能

通过命令行安装

skillhub install claw-crony-1776020238

下载

⬇ 下载 a2a-setup v1.0.2(免费)

文件大小: 4.93 KB | 发布时间: 2026-4-13 09:44

v1.0.2 最新 2026-4-13 09:44
claw-crony 1.0.2 changelog

- Added detailed setup instructions for installing and configuring the Claw Crony A2A Gateway plugin to enable cross-server agent-to-agent (A2A) communication.
- Included step-by-step guidance for plugin installation, security token management, peer registration, network configuration (including Tailscale), and end-to-end testing.
- Clarified the distinction and correct usage of `agentCard.url` vs. `peers[].agentCardUrl` for message delivery and peer discovery.
- Provided updated TOOLS.md integration requirements to ensure agent awareness and correct usage of A2A capabilities.
- Added troubleshooting guidance and a mutual peering checklist for reliable two-way connectivity.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部