A2a Gateway
/install a2a-gateway
A2A Gateway — Agent Service Bus
定位
OpenClaw Agent 网络的协作基础设施层。 所有 Agent 的发现、注册、委托、追踪、审计都经过它。
用户
↓
[其他 Agent / 驾驶舱]
↓
A2A Gateway(灵枢)
↓
招商助手 | 企服助手 | 招商智库 | ...
五大模块
① Agent Registry(注册中心)
管理 OpenClaw Agent 的 Agent Card,类似 A2A 协议中的 Agent Card 机制。
Agent Card 结构:
{
"agent_id": "招商助手",
"name": "招商助手",
"description": "产业园招商运营助手",
"skills": ["客户分析", "招商周报", "企业画像"],
"capabilities": ["客户风险评估", "产业链分析"],
"status": "online",
"updated_at": "2026-06-07T10:00:00Z",
"created_at": "2026-06-07T10:00:00Z"
}
CLI 用法:
# 注册 Agent
python3 scripts/registry.py register \x3Cagent_id> \x3Cname> \x3Cdescription> \x3Cskills_csv>
# 查询
python3 scripts/registry.py get \x3Cagent_id>
# 列出全部
python3 scripts/registry.py list
# 按技能搜索
python3 scripts/registry.py find \x3Ckeyword>
# 从 openclaw.json 同步
python3 scripts/registry.py sync \x3Copenclaw.json路径>
② Capability Router(能力路由)
核心模块:识别用户意图 → 匹配最佳 Agent → 创建委托任务。
路由流程:
用户请求 → 意图解析(关键词匹配) → 搜索 Registry
→ 选中最佳 Agent → 创建 Task → 返回 task_id
CLI 用法:
python3 scripts/router.py \x3Cfrom_agent> "\x3Cuser_intent>"
# 例如: python3 scripts/router.py 招商驾驶舱 "分析客户流失风险"
MVP 说明:当前使用关键词匹配。 升级路径:LLM 意图分类 → Agent 能力图谱。
③ Task Center(任务中心)
管理跨 Agent 委托任务的生命周期。
任务状态机:
PENDING → RUNNING → COMPLETED
→ FAILED
→ CANCELLED
CLI 用法:
# 创建任务
python3 scripts/task_center.py create \x3Cfrom> \x3Cto> \x3Cskill> "\x3Cdescription>"
# 查询
python3 scripts/task_center.py get \x3Ctask_id>
python3 scripts/task_center.py list [--status RUNNING] [--from from_agent] [--to to_agent]
# 更新状态
python3 scripts/task_center.py update \x3Ctask_id> \x3Cnew_status> [--result 'json'] [--error 'msg']
# 健康检查:查超时任务
python3 scripts/task_center.py stuck [threshold_minutes]
④ Audit Trail(协作审计链)
记录每次委托的完整链路,支持 trace_id 串联多跳协作。
CLI 用法:
# 记录审计事件
python3 scripts/audit.py record \x3Ctrace_id> \x3Cfrom> \x3Cto> \x3Cskill> [--status success|failure]
[--duration 8.5] [--error "错误信息"]
# 查询日志
python3 scripts/audit.py query [--trace_id trace_xxx] [--from from] [--to to] [--limit 50]
# 获取完整链路图
python3 scripts/audit.py trace \x3Ctrace_id>
# 统计
python3 scripts/audit.py stats [days]
链路图示例:
招商驾驶舱 → 招商助手 → 企服助手 → 招商智库
⑤ Health Check(健康检测)
每小时检查所有注册 Agent 的在线状态。
状态类型:online / offline / error / stale(超过24h未更新)/ unknown
CLI 用法:
python3 scripts/health.py check # 检查全部
python3 scripts/health.py report # 驾驶舱友好报告
python3 scripts/health.py status \x3Cagent_id> # 单个状态
数据目录
~/.qclaw/workspace-a2a-gateway/
├── registry/agent_cards.json # Agent 能力目录
├── tasks/tasks.json # 任务状态库
├── audit/audit_log.json # 协作审计链
└── health/health_status.json # 健康状态快照
与报告框架的对应关系
| 报告概念 | A2A Gateway 模块 |
|---|---|
| Agent Card | Agent Registry |
| Task 对象 | Task Center |
| 协作审计链 | Audit Trail |
| 能力发现/路由 | Capability Router |
| Agent 存活检测 | Health Check |
| Agent Link(信任锚) | Audit Trail + Registry 联合实现 |
常见操作示例
场景:用户从驾驶舱发起"客户流失风险分析"
- Router 接收请求
- 在 Registry 中搜索匹配
["客户分析","风险评估"]的 Agent → 找到招商助手 - Task Center 创建任务
task_xxx,状态PENDING - 返回
task_id给驾驶舱 - 任务执行完成后,Audit Trail 记录完整链路
场景:检查协作健康
python3 scripts/task_center.py stuck 60
python3 scripts/audit.py stats 7
python3 scripts/health.py report
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install a2a-gateway - 安装完成后,直接呼叫该 Skill 的名称或使用
/a2a-gateway触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
A2a Gateway 是什么?
A2A Gateway 是 OpenClaw Agent 网络的协作总线(Agent Service Bus)。 当用户提到以下场景时使用此 skill: (1) 注册/管理/查询 Agent 能力目录(Agent Card) (2) 发起跨 Agent 任务委托、路由、追踪 (3) 查询/分析 Agent 协作... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 39 次。
如何安装 A2a Gateway?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install a2a-gateway」即可一键安装,无需额外配置。
A2a Gateway 是免费的吗?
是的,A2a Gateway 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
A2a Gateway 支持哪些平台?
A2a Gateway 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 A2a Gateway?
由 perrykono-debug(@perrykono-debug)开发并维护,当前版本 v1.0.0。