360 Secure SkillHub
360 安全技能中心

Agent Communication Hub

核心功能:支持点对点/广播消息、带过滤的事件发布订阅、智能体注册与会话追踪、离线消息队列及SQLite持久化通信历史。典型场景:多OpenClaw智能体需可靠消息交换、事件分发或留存通信记录的场景。使用时需创建CommunicationHub实例,注册智能体后可收发消息、订阅/发布事件,消息与事件以JSON存储,支持消息确认与历史重放,保障送达可靠性。

imgolye
imgolye
热度 65.40
最近更新 2026-05-11 17:29:24
分类:开发依赖:代码执行 / 读写文件 / MCP 服务应用场景:API 集成 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add agent-communication-hub
Metadata
name
agent-communication-hub
description
Provide agent-to-agent communication for OpenClaw skills with direct messaging, broadcast delivery, pub/sub events, session tracking, offline queues, and SQLite-backed persistence. Use when agents need reliable message exchange, event fan-out, subscription filtering, or communication history.

Agent Communication Hub

Use this skill when multiple agents need a shared communication layer with durable delivery and session awareness.

What It Provides

  • Point-to-point, private, and broadcast messaging
  • Event publish/subscribe with subscription filters
  • Agent registration, presence tracking, and session history
  • Offline message queueing, persistence, and acknowledgements
  • SQLite-backed audit history for messages and events

Project Layout

  • src/CommunicationHub.ts: Main entry point that coordinates messaging, storage, queueing, and acknowledgements
  • src/EventBus.ts: Event publish/subscribe, replay, and filter evaluation
  • src/SessionManager.ts: Agent lifecycle, presence, and session history
  • tests/: Vitest coverage for messaging, sessions, queueing, and events
  • examples/: Minimal runnable example

Workflow

  1. Create a CommunicationHub with a SQLite database path.
  2. Register agents through SessionManager.
  3. Connect or disconnect agents to update presence state.
  4. Send direct, private, or broadcast messages through CommunicationHub.
  5. Subscribe agents to event types through EventBus.
  6. Publish events and replay history when needed.
  7. Acknowledge delivered messages to complete queue processing.

Notes

  • Broadcast delivery fans out to all registered agents except the sender.
  • Offline direct messages remain queued until the recipient connects or explicitly drains the queue.
  • Event filters use exact key/value matching against event payload fields.
  • Message and event payloads are stored as JSON for flexible schemas.