惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
有赞技术团队
有赞技术团队
量子位
N
Netflix TechBlog - Medium
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
GbyAI
GbyAI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Blog — PlanetScale
Blog — PlanetScale
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
Martin Fowler
Martin Fowler
Y
Y Combinator Blog
宝玉的分享
宝玉的分享
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
V
V2EX
IT之家
IT之家
L
LangChain Blog
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

陈少文的网站

巨变与机遇的未来十年 Kubernetes 平台管理软件压力测试方案 使用镜像部署 Hexo 静态页面 终于等到你 - GitHub 镜像仓库服务(ghcr.io) 一起来学 Go --(6)Interface 一起来学 Go --(5)Goroutine 和 Channel 什么是函数式编程 如何在 Kubernetes 集群集成 Kata 柯里化与偏函数 使用 PyGithub 自动创建 Label 软件产品是团队能力的输出 Helm 2 、Helm 3 比较 IoT 变现 Kubernetes 中的 DNS 服务 国内的 Helm 镜像源 Harbor 使用自签证书支持 Https 访问 DevOps 工具链之 Prow 如何使用 kfctl 安装 Kubeflow VS Code 无法下载 Go 插件的工具包 工程师更应具有服务精神 你不知道的 Docker 使用技巧 使用 Docker 运行 Tensorflow 论中国 什么是左移 如何清空 Git 仓库全部历史记录 一禅小和尚 有风吹过厨房 时间的玫瑰 如何在 CentOS 安装 GPU 驱动 开发 Tips(19)
使用 A2A Gateway 打通多 OpenClaw
微信公众号 · 2026-04-15 · via 陈少文的网站

1. 架构

1
2
3
4
5
6
7
┌──────────────────────┐         A2A/JSON-RPC          ┌──────────────────────┐
│    OpenClaw 服务器 A  │ ◄──────────────────────────►  │    OpenClaw 服务器 B   │
│                      │      (Tailscale / 内网)        │                       │
│  Agent: AGI          │                               │  Agent: Coco          │
│  A2A 端口: 18800      │                               │  A2A 端口: 18800│  Peer: Server-B      │                               │  Peer: Server-A       │
└──────────────────────┘                               └──────────────────────┘

要求:

  • OpenClaw ≥ 2026.3.0 已安装并运行
  • OpenClaw 之间网络连通
  • Node.js ≥ 22

2. 安装

  • 下载到本地插件目录
1
2
3
4
5
mkdir -p ~/.openclaw/workspace/plugins
cd ~/.openclaw/workspace/plugins
git clone https://github.com/win4r/openclaw-a2a-gateway.git a2a-gateway
cd a2a-gateway
npm install --production
  • 强制安装
1
openclaw plugins install ~/.openclaw/workspace/plugins/a2a-gateway --dangerously-force-unsafe-install 

不同的 OpenClaw 版本,忽略安全的参数会有所差异,需要查看一下 --help 的说明。

  • 重启服务
1
openclaw gateway restart

3. 注册插件

  • 查看插件列表
1
openclaw config get plugins.allow
  • 将新插件添加到列表中
1
2
3
4
5
openclaw config set plugins.allow '["a2a-gateway"]'

openclaw config set plugins.load.paths '["/root/.openclaw/workspace/plugins/a2a-gateway"]'

openclaw config set plugins.entries.a2a-gateway.enabled true

4. 配置 Agent

  • 配置 Agent Card

配置当前 Agent 所需的信息

1
2
3
4
openclaw config set plugins.entries.a2a-gateway.config.agentCard.name 'Ops-Copilot'
openclaw config set plugins.entries.a2a-gateway.config.agentCard.description '智能运维助手'
openclaw config set plugins.entries.a2a-gateway.config.agentCard.url 'http://1.1.1.1:18800/a2a/jsonrpc'
openclaw config set plugins.entries.a2a-gateway.config.agentCard.skills '[{"id":"ops-doctor","name":"运维诊断","description":"针对节点、集群、负载的异常诊断"}]'
  • 配置 A2A 服务器
1
2
openclaw config set plugins.entries.a2a-gateway.config.server.host '0.0.0.0'
openclaw config set plugins.entries.a2a-gateway.config.server.port 18800
  • 配置安全认证

生成入站认证 Token:

1
2
TOKEN=$(openssl rand -hex 24)
echo "A2A Token: $TOKEN"
1
2
openclaw config set plugins.entries.a2a-gateway.config.security.inboundAuth 'bearer'
openclaw config set plugins.entries.a2a-gateway.config.security.token "$TOKEN"

这个 TOKEN 其他 Agent 连接过来时,进行鉴权。

  • 配置 Agent 路由
1
openclaw config set plugins.entries.a2a-gateway.config.routing.defaultAgentId 'main'

默认使用 main

  • 重启网关
1
openclaw gateway restart
  • 验证 agent-card 信息
1
curl -s http://localhost:18800/.well-known/agent-card.json | python3 -m json.tool
  • 验证 agent 能正常接收其他 agent 的调用
1
2
3
4
node /home/kas/.openclaw/workspace/plugins/a2a-gateway/skill/scripts/a2a-send.mjs \
  --peer-url http://x.x.x.x:18800 \
  --token xxx \
  --message "你好,来自外部调用的消息"

其实另外一个消息调用此 agent 也是基于此方法。

5. 其他 Agent 配置

  • 安装 A2A Gateway

参考上面的步骤

  • 配置需要使用的 Agent
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
openclaw config set plugins.entries.a2a-gateway.config.peers '[
  {
    "name": "ops-copilot",
    "agentCardUrl": "http://1.1.1.1:18800/.well-known/agent-card.json",
    "auth": {
      "type": "bearer",
      "token": "xxxxxxxxxxx"
    }
  }
]'
  • 添加 TOOLS

在 workspace/TOOLS.md 添加以下内容,告诉 OpenClaw 怎么使用。

https://raw.githubusercontent.com/win4r/openclaw-a2a-gateway/refs/heads/master/skill/references/tools-md-template.md

  • 测试使用
1
openclaw agent --agent main -m "通过 A2A 让 ops-copilot 查一下集群状态"

此时,会向另外一个 agent 发送处理请求。

6. 参考

https://github.com/win4r/openclaw-a2a-gateway/issues/53
https://github.com/win4r/openclaw-a2a-gateway/blob/master/README_CN.md#3-配置-agent-card