← Back to Skills Marketplace
95
Downloads
1
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install hermes-multiagent-skill
Description
突触式多智能体通信调度,像人类神经突触一样,毫秒级分发,精准对齐,把 100 个 Agent 同时协同的通信成本降到最低
README (SKILL.md)
Hermes 协议 - 多智能体高并发调度
核心设计: 当 100 个 Agent 同时协同工作,通信成本如何降到最低? Hermes 模仿人类神经突触:只有已建立连接(订阅)才传递消息,不做全量广播
前置要求
- sessions_spawn 集成:
HermesSessionsIntegration依赖外部sessions_spawnAPI 存在。 仅使用HermesRouter/HermesAgent手动订阅发布时无需 sessions_spawn。 - 数据存储:本 skill 不创建任何数据库文件。如需持久化记忆或技能进化, 由上层业务自行实现,本 skill 只负责消息调度。
特性
- ⚡ 毫秒级分发:平均单消息投递 \x3C 0.1ms
- 💰 通信成本最低:稀疏订阅,只投递感兴趣的 Agent,节省 50%-90% 通信量
- 🎯 精准对齐:每个 Agent 只收到自己该处理的任务,不被打扰
- 🔌 完美集成 sessions_spawn:spawn 后自动注册订阅,退出自动清理
- 🛡️ 安全可控:参数可调,不会疯狂消耗资源
- 📦 零依赖:纯 Python,只用标准库
快速开始
导入
from skills.hermes_multiagent_skill import (
hermes, # 全局路由器
HermesRouter, # 可创建独立路由器
hermes_sessions, # 与 sessions_spawn 集成
HermesSessionsIntegration,
HermesMessage, # 消息结构
HermesAgent, # Agent 基类
)
基本用法:手动订阅发布
from skills.hermes_multiagent_skill import hermes, HermesMessage
def my_handler(msg: HermesMessage):
print(f"收到: {msg.topic}, payload={msg.payload}")
# Agent 订阅自己关心的主题
hermes.subscribe(agent_id="my-agent-id", topic="task:code-review", handler=my_handler)
# 发布消息,自动分发给所有订阅者
hermes.publish(topic="task:code-review", from_agent="publisher-id",
session_id="session-id", payload={"pr": "..."})
与 sessions_spawn 集成(推荐日常使用)
from skills.hermes_multiagent_skill import hermes_sessions
# 1. spawn 子智能体后调用
session_key = ... # sessions_spawn 返回的 session key
hermes_sessions.on_agent_spawn(
session_key=session_key,
agent_id="code-review-agent",
hermes_topics=["task:code-review", "done:web-search"],
message_handler=lambda topic, payload: print(f"{topic}: {payload}")
)
# → 自动完成所有订阅,消息通过 message_handler 回调
# 2. 提交任务,自动分发
task_id = hermes_sessions.submit_task_to_agents(
task_type="code-review",
creator="user",
session_id="main",
payload={"pr": "https://github.com/..."}
)
# → Hermes 自动分给所有订阅了 code-review 的 Agent
# 3. Agent 退出自动清理
hermes_sessions.on_agent_exit(session_key)
# → 自动取消所有订阅,注销 Agent
Agent 基类
from skills.hermes_multiagent_skill import HermesAgent, HermesRouter, HermesMessage
router = HermesRouter(max_workers=16)
agent = HermesAgent(agent_id="my-agent", router=router)
def handler(msg: HermesMessage):
print(msg.payload)
agent.subscribe("task:code-review", handler)
agent.publish("task:done", session_id="s1", payload={"result": "ok"})
agent.unsubscribe("task:code-review")
性能对比(20 Agent,8 任务)
| 指标 | Hermes 协议 | 传统全量广播 |
|---|---|---|
| 总投递次数 | 40 | 160 |
| 总耗时 | 11.2 ms | 23.3 ms |
| 节省通信量 | 75% | - |
| 速度提升 | 2.1x | - |
Agent 越多,节省越明显:100 Agent 能节省 ~90% 通信量。
API
HermesRouter
router = HermesRouter(max_workers=None, pool_max=1000)
router.subscribe(agent_id, topic, handler) # 订阅
router.unsubscribe(topic, agent_id) # 取消订阅
router.publish(topic, from_agent, session_id, payload, trace_id="") -> int # 发布
router.get_stats() -> dict # 统计
router.shutdown() # 关闭线程池
HermesAgent
agent = HermesAgent(agent_id, router)
agent.subscribe(topic, handler) # 订阅主题
agent.unsubscribe(topic) # 取消订阅
agent.publish(topic, session_id, payload, trace_id="") -> int # 发布
agent.stats() -> dict # 当前 Agent 统计
HermesSessionsIntegration(集成 sessions_spawn)
hermes_sessions.on_agent_spawn(
session_key, agent_id, hermes_topics,
message_handler=None # Callable[[str, Any], None],默认静默丢弃
) -> HermesSubAgent
hermes_sessions.on_agent_exit(session_key)
hermes_sessions.submit_task_to_agents(
task_type, creator, session_id, payload
) -> task_id: str
hermes_sessions.publish_done(task_type, task_id, result, session_id, agent_id)
hermes_sessions.publish_system(event_type, payload, session_id, agent_id)
hermes_sessions.list_agents() -> List[HermesSubAgent]
hermes_sessions.stats() -> dict
安全说明
- 幂等取消:
unsubscribe对同一 agent 多次调用安全,不会导致计数变负 - 对象池上限:默认最多缓存 1000 条消息,防止极端情况内存膨胀
- pending 任务清理:超过
pending_task_ttl(默认 1 小时)的任务自动清除 - 输入校验:空
agent_id、空topic等参数会抛出ValueError - 线程安全:所有内部状态通过
threading.RLock保护,50 并发压测零错误
依赖
- Python 3.8+
- 零第三方依赖(不使用 SQLite,不创建任何数据库文件)
License
MIT
Usage Guidance
This package is a local, in-memory pub/sub router and the code matches the documentation. Before installing consider: (1) handlers you register will be executed on background threads—ensure they are thread-safe and do not run untrusted code; (2) the router keeps an in-memory message pool (default pool_max 1000) and pending task map — a flood of messages or very large payloads could exhaust memory or cause delays; (3) the sessions_spawn integration assumes an external sessions_spawn API is available — confirm that integration point and its trust boundary; (4) the skill does not perform network calls or store credentials by itself, but if you pass external callbacks or integrate with remote session managers those components may introduce network I/O or require credentials. As usual, review and run in a restricted environment before trusting with sensitive data.
Capability Analysis
Type: OpenClaw Skill
Name: hermes-multiagent-skill
Version: 1.0.3
This skill bundle implements the 'Hermes' protocol, a pub/sub messaging system designed for high-concurrency multi-agent coordination. The code (hermes.py and hermes_sessions_integration.py) uses standard Python libraries like threading and concurrent.futures to manage message routing and agent lifecycles without any external dependencies or network calls. There is no evidence of data exfiltration, malicious execution, or prompt injection; the logic is entirely consistent with its stated purpose of providing an efficient communication layer for agents.
Capability Assessment
Purpose & Capability
Name/description describe a multi-agent, high-concurrency message router; included Python modules implement HermesRouter, HermesAgent, and a sessions_spawn integration. No unrelated credentials, binaries, or downloads are requested.
Instruction Scope
SKILL.md documents only local API usage and sessions_spawn integration. It does require an external sessions_spawn API to exist for the optional integration; otherwise the HermesRouter/HermesAgent APIs operate locally. The instructions do not ask the agent to read files, env vars, or contact external network endpoints by default.
Install Mechanism
There is no external install spec or network download; the skill is an instruction+source bundle. All code is included in the package and uses only the Python standard library.
Credentials
The skill declares no required environment variables or external credentials and the code does not access environment secrets. No disproportionate credential/system access is requested.
Persistence & Privilege
always is false and the skill does not request persistent platform privileges or modify other skills' configuration. It keeps in-memory state only and exposes lifecycle methods to register/unregister agents.
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install hermes-multiagent-skill - After installation, invoke the skill by name or use
/hermes-multiagent-skill - Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.3
Version 1.0.3
- Expanded documentation to clarify integration requirements for sessions_spawn and separation of data storage responsibilities.
- Added details and code samples for using new HermesAgent base class and HermesMessage structure.
- Updated examples and function signatures to reflect current API (e.g., new parameters, explicit argument names).
- Introduced new API sections covering HermesAgent methods and richer HermesSessionsIntegration usage.
- Added security section describing unsubscribe idempotency, message pool limits, input validation, and thread safety improvements.
- Noted removal of internal database usage—this skill no longer creates or requires SQLite files.
v1.0.1
- Version bump to 1.0.1
- Added Python 3.14 compiled cache files for initialization and main Hermes logic
v1.0.0
Initial release of Hermes Multi-Agent High-Concurrency Scheduling Protocol.
- Enables synapse-inspired, millisecond-level multi-agent communication with minimal overhead.
- Supports precise, topic-based message delivery: only subscribed agents receive relevant messages, avoiding full-broadcast.
- Integrates seamlessly with sessions_spawn for automatic agent subscription, task dispatching, and cleanup.
- Achieves up to 90% reduction in message delivery overhead for large agent groups (e.g., 100 agents).
- Pure Python implementation with no external dependencies beyond the standard library and built-in SQLite.
Metadata
Frequently Asked Questions
What is hermes multiagent skill?
突触式多智能体通信调度,像人类神经突触一样,毫秒级分发,精准对齐,把 100 个 Agent 同时协同的通信成本降到最低. It is an AI Agent Skill for Claude Code / OpenClaw, with 95 downloads so far.
How do I install hermes multiagent skill?
Run "/install hermes-multiagent-skill" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is hermes multiagent skill free?
Yes, hermes multiagent skill is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does hermes multiagent skill support?
hermes multiagent skill is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created hermes multiagent skill?
It is built and maintained by briefness (@briefness); the current version is v1.0.3.
More Skills