openclaw - 💡(How to fix) Fix [Feature]: 建议:支持跨 Gateway 的 Agent 间异步通信

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

支持跨 Gateway 的 Agent 间异步通信

Root Cause

支持跨 Gateway 的 Agent 间异步通信

RAW_BUFFERClick to expand / collapse

Summary

支持跨 Gateway 的 Agent 间异步通信

Problem to solve

场景描述

我们运行两个 OpenClaw Gateway 实例(两台树莓派,各一个 Gateway),每个 Gateway 上运行一个 Agent:

  • pi-dst(小派 🤖)— 执行/运维型
  • pi-nxp(大派 🧠)— 规划/分析型

两个 Agent 需要异步协作:小派完成运维任务后通知大派做分析,或者大派出方案后需要小派执行落地。

问题陈述

OpenClaw 目前不支持跨 Gateway 实例的 Agent 间通信。 同一 Gateway 上的多 Agent 通信已有解决方案,但不同 Gateway 上的 Agent 无法直接互相发现和发消息,这是当前功能的空白。

我们目前的变通方案

我们在 OpenClaw 外部自建了一个留言板系统:

  1. 共享的 messages.json 文件作为消息队列
  2. 每个 Agent 运行一个 message-poller(系统 cron 每 3 分钟扫描)
  3. 发现新消息后调用 openclaw cron add + cron run 创建 agentTurn 唤醒目标 Agent
  4. 消息状态机(sent → read → processed),支持 ACK 回执

这套方案虽然能跑,但毕竟是 OpenClaw 外部的 DIY 方案,不够原生,维护成本高。

Proposed solution

建议的改进方向

方案 A:跨 Gateway 消息路由

允许一个 Gateway 上的 Agent 调用 tools/send_message(remote_gateway_id, remote_agent_id, content) 向另一个 Gateway 上的 Agent 发消息。路由寻址可基于 Tailscale 或其他网络方案。

方案 B:分布式收件箱

每个 Agent 在本地持有一个持久化收件箱。Gateway 间通过 HTTP 或 Tailscale Funnel 同步收件箱状态。Agent 收到消息后自动触发 agentTurn 处理。

方案 C:远程 agentTurn 触发

如果一个 Gateway 能通过 HTTP API 触发另一台机器的 agentTurn(类似 openclaw cron run 但跨机器),就不需要自建轮询了。

解决了什么

  1. 填补跨 Gateway Agent 通信的功能空白
  2. 消除自建轮询的维护成本
  3. 多 Gateway 部署场景的原生支持
  4. Token 消耗可控 — 消息通道不经过大模型推理

附加参考

自建方案中遇到的几个问题供参考:

  • 轮询频率需要平衡实时性和成本(我们设为 3 分钟)
  • 需要去重机制(2小时 TTL 防止同一消息多次唤醒 Agent)
  • cron 任务若使用 --every N 会导致任务堆积和 Token 异常消耗,需改用即时触发 + 自动删除
  • --announce 会将 agentTurn 日志推送到人类聊天窗口(visibility 问题)
  • 消息需持久化以支持审计追溯

建议基于 2026年5月1日-8日的实际多 Gateway 协作实践 环境:Raspberry Pi OS, Tailscale 组网, 双 OpenClaw Gateway

Alternatives considered

No response

Impact

影响

受影响的用户群体:跨gateway的多agent用户 严重程度:annoying, blocks workflow 紧迫性:紧迫 痛点发生的频率:always 实际后果:不能协同

Evidence/examples

No response

Additional information

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Feature]: 建议:支持跨 Gateway 的 Agent 间异步通信