政安晨的个人主页:政安晨
欢迎 👍点赞✍评论⭐收藏
希望政安晨的博客能够对您有所裨益,如有不足之处,欢迎在评论区提出指正!
本文完整记录了如何将 OpenClaw 的多渠道接入能力与 Hermes 的深度任务执行能力结合,构建一套完整的本地 AI 协作系统。
目录
系列概览
🎯 核心技术
💡 适用场景
第一部分:认识两位主角
01 | OpenClaw:你的多渠道 AI 网关
2 | Hermes:会自我进化的 AI 助手
第二部分:协作架构设计与安装
03 | ACP 协议:两者的通信桥梁
04 | 安装部署(完整步骤)
1. 安装 OpenClaw(Gateway)
2. 安装 Hermes
3. 配置 OpenClaw 飞书渠道
4. 安装 OpenClaw 飞书插件
5. 配置 Hermes ACP 模式
05 | HermesCooperator 任务调度器
方式一:直接提问(ask)
方式二:结构化委托(delegate)
方式三:优先级调度队列(schedule)
三部分:实战任务协作
06 | 场景一:飞书消息 → 多 Agent 并行工作
07 | 场景二:信息聚合与博客写作
08 | 场景三:定时自动化任务
09 | 场景四:深度代码开发流水线
第四部分:常见问题与解决方案
10 | 排错指南
问题 1:Hermes 返回 RuntimeError(socks 代理错误)
问题 2:飞书消息无法接收
问题 3:Hermes 任务超时
问题 4:Hermes 记忆丢失
问题 5:OpenClaw 与 Hermes 通信失败
关键技术总结
协作模式速查
参考资源
🎯 核心技术
- ACP(Agent Client Protocol):OpenClaw 与 Hermes 之间的通信协议
- HermesCooperator:任务调度器,支持优先级队列与并发控制
- 记忆层共享:OpenClaw 接收结果 → 写入文件 → Hermes 读取执行
- 飞书消息触发:用户发一条飞书消息,驱动后台多个 AI Agent 并行工作
💡 适用场景
01 | OpenClaw:你的多渠道 AI 网关
定位:自托管的 AI 助手网关,连接你日常使用的所有聊天平台。

核心特点:
- 支持 20+ 聊天渠道(飞书、Discord、Telegram、WhatsApp 等)
- 多 Agent 路由:不同人、不同群 → 不同 Agent 脑
- MCP(Model Context Protocol)集成:像 USB 一样连接外部工具
- 自托管:数据留在你自己的机器上
- MIT 协议,完全开源
适用人群:希望掌控自己 AI 数据、在任意平台收发消息的开发者与极客。
2 | Hermes:会自我进化的 AI 助手
定位:由 Nous Research 打造的自我改进型 AI Agent。
核心特点:
- 程序性记忆(Procedural Memory):每次复杂任务后自动创建 Skills,越用越强
- 内置记忆层:周期性向记忆文件写入关键上下文,跨 Session 保持连续性
- 任务委托与并行化:可将任务分发给隔离的 Subagent,并行处理加速
- Cron 调度:用自然语言描述定时任务,自动执行并推送结果
- 181 个内置技能:涵盖 MLOps(llama-cpp、vLLM、unsloth)、代码开发(Claude Code、Codex)、GitHub 管理(issues、PR、code review)、研究(arXiv、wiki)等
与 OpenClaw 的互补性:
03 | ACP 协议:两者的通信桥梁
什么是 ACP?
ACP(Agent Client Protocol)是一种标准化协议,用于连接两个 AI Agent runtime。OpenClaw 通过 ACP 可以:
- 激活 Hermes 的 ACP 模式
- 通过 stdio 与 Hermes 子进程通信
- 在 Hermes 中创建独立 Session 执行任务

ACP 模式下的 Hermes 可用工具:
04 | 安装部署(完整步骤)
硬件要求:
- CPU:任意 x86_64 / ARM64
- 内存:最低 4GB(推荐 8GB+)
- 系统:Linux / macOS / WSL2
1. 安装 OpenClaw(Gateway)
# 方式一:npm 全局安装(推荐) npm install -g openclaw@latest
方式二:pnpm
pnpm add -g openclaw@latest
验证安装
openclaw –version
2. 安装 Hermes
# 一键安装脚本(Linux/macOS/WSL2) curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
验证安装
hermes –version
启动交互式 CLI
hermes
3. 配置 OpenClaw 飞书渠道
# 进入引导配置 openclaw onboard
或手动配置(编辑配置文件)
openclaw config edit
飞书配置示例(~/.openclaw/openclaw.json):
{ “channels”: {
"feishu": { "enabled": true, "botToken": "你的飞书 Bot Token", "appSecret": "你的飞书 App Secret", "encryptKey": "你的加密密钥" }
}, “agents”: {
"defaults": { "model": "minimax-portal/MiniMax-M2.5-HighSpeed" }
} }
4. 安装 OpenClaw 飞书插件
# 官方推荐方式安装插件 ~/.npm-global/bin/openclaw plugins install @larksuite/openclaw-lark
重启 Gateway
openclaw gateway restart
5. 配置 Hermes ACP 模式
Hermes 协作脚本已内置于 OpenClaw workspace:
/home/aaa/.openclaw/workspace/scripts/hermes_coordinator.py
首次验证 ACP 连接:
# 测试 Hermes ACP 连接 /home/aaa/.hermes/hermes-agent/venv/bin/python3 /home/aaa/.openclaw/workspace/scripts/hermes_coordinator.py ask “你好,返回当前时间” –timeout 30
成功响应示例:
[Coop] ✅ New session xxxxxxxx-xxxx-xxxx 你好!当前时间是 2026年4月14日 星期二 10:00 AM。
05 | HermesCooperator 任务调度器
文件路径:/home/aaa/.openclaw/workspace/scripts/hermes_coordinator.py
三种调用方式:
方式一:直接提问(ask)
Python API:
from scripts.hermes_coordinator import HermesCooperator
async with HermesCooperator(timeout=300) as coop:
result = await coop.ask("用 Python 写一个快速排序")
print(result)
CLI 命令:
/home/aaa/.hermes/hermes-agent/venv/bin/python3 scripts/hermes_coordinator.py ask “写一个快速排序” –timeout 60
方式二:结构化委托(delegate)
# 委托 Hermes 执行特定类型任务 /home/aaa/.hermes/hermes-agent/venv/bin/python3 scripts/hermes_coordinator.py delegate “研究量子计算的最新进展” –type research –priority high
支持的任务类型:coding / research / mlops / creative / data / general
支持优先级:urgent / high / normal / low
方式三:优先级调度队列(schedule)
from scripts.hermes_coordinator import HermesScheduler, Priority
scheduler = HermesScheduler() scheduler.submit(“写代码报告”, priority=Priority.URGENT) scheduler.submit(“整理今日新闻”, priority=Priority.NORMAL) scheduler.run(max_concurrent=2) # 最多2个并发
for result in scheduler.results():
print(result)
HermesScheduler 内部机制:

06 | 场景一:飞书消息 → 多 Agent 并行工作
场景描述:用户在飞书发一条消息,OpenClaw 接收后同时触发 Hermes 研究和代码开发,OpenClaw 整合结果发回飞书。

测试命令:
# 测试并行任务分发
/home/aaa/.hermes/hermes-agent/venv/bin/python3 scripts/hermes_coordinator.py delegate “搜索今天全球科技新闻 5 条,用中文列出摘要” –type research –priority normal
同时分发代码任务
/home/aaa/.hermes/hermes-agent/venv/bin/python3 scripts/hermes_coordinator.py delegate “用 Python 写一个斐波那契数列函数,包含测试代码” –type coding –priority high
07 | 场景二:信息聚合与博客写作
场景描述:让 Hermes 研究多个信息源,OpenClaw 整合成一篇结构化博客文章。

测试命令:
/home/aaa/.hermes/hermes-agent/venv/bin/python3 scripts/hermes_coordinator.py ask “研究 OpenClaw 和 Hermes 的最新集成方法,写一篇中文博客” –timeout 120
08 | 场景三:定时自动化任务
场景描述:每天早上 9:00 自动执行 Hermes 任务,结果发回飞书。
配置 OpenClaw Cron:
# 创建每日早报定时任务 openclaw cron add –name “daily-tech-news” –schedule “0 9 * * *” –message “让 Hermes 搜索今日全球科技要闻 10 条,中文摘要” –deliver-to feishu
Cron 表达式说明:
表达式
含义
0 9 * *
每天 9:00
/30 * * * *
每 30 分钟
0 9 * * 1-5
工作日 9:00
查看 Cron 任务列表:
openclaw cron list openclaw cron runs daily-tech-news # 查看执行历史
09 | 场景四:深度代码开发流水线
场景描述:用户在飞书描述需求,Hermes 完成完整代码开发流程。

实战测试命令:
/home/aaa/.hermes/hermes-agent/venv/bin/python3 scripts/hermes_coordinator.py delegate “创建一个 Python Web 服务器,支持:
- GET /hello 返回 JSON
- GET /time 返回当前时间
- 使用 Flask 框架
- 包含单元测试” –type coding –priority high
10 | 排错指南
问题 1:Hermes 返回 RuntimeError(socks 代理错误)
症状:
Sorry, I encountered an error (RuntimeError). Failed to initialize OpenAI client: Unknown scheme for proxy URL URL(‘socks://127.0.0.1:7890/’)
原因:
- 系统代理
ALL_PROXY设置为socks://格式 - Hermes 底层 httpx 库只认
socks5://,不认socks:// - 来自 GNOME 系统代理设置(mode=manual,SOCKS 指向 127.0.0.1:7890)
解决方案:
# 方案一:修改 GNOME 代理为 socks5(一劳永逸,推荐) gsettings set org.gnome.system.proxy.socks host ‘127.0.0.1’ gsettings set org.gnome.system.proxy.socks port 7890 方案二:启动时覆盖环境变量
ALL_PROXY=socks5://127.0.0.1:7890/ hermes acp
方案三:仅对 Hermes 进程设置
ALL_PROXY=socks5://127.0.0.1:7890/ http_proxy=http://127.0.0.1:7890/ https_proxy=http://127.0.0.1:7890/ hermes acp
验证修复:
/home/aaa/.hermes/hermes-agent/venv/bin/python3 scripts/hermes_coordinator.py ask “你好,返回时间” –timeout 30
问题 2:飞书消息无法接收
症状:用户发飞书消息,OpenClaw 无响应。
排查步骤:
# 1. 检查 Gateway 状态 openclaw gateway status 2. 检查飞书插件版本
openclaw plugins list
3. 检查 Gateway 日志
openclaw gateway logs –tail 50
4. 测试飞书连接
openclaw channels status –probe feishu
常见原因与解决:
问题 3:Hermes 任务超时
症状:TimeoutError 或长时间无响应。
解决方案:
# 增加超时时间(改为 600 秒) /home/aaa/.hermes/hermes-agent/venv/bin/python3 scripts/hermes_coordinator.py ask “你的任务” –timeout 600
问题 4:Hermes 记忆丢失
症状:每次会话 Hermes 都像全新一样,不记得之前的事情。
解决方案:
# 检查 Hermes 记忆状态 ls ~/.hermes/memories/ cat ~/.hermes/memories/latest.md # 最新记忆
手动触发记忆写入
/home/aaa/.hermes/hermes-agent/venv/bin/python3 scripts/hermes_coordinator.py ask “记住:我叫政安晨,邮箱是 ,主要研究AI感知交互” –timeout 30
问题 5:OpenClaw 与 Hermes 通信失败
症状:Connection refused 或 Cannot find hermes_coordinator.py。
排查步骤:
# 1. 确认 Hermes 进程在运行 ps aux | grep hermes | grep -v grep 2. 确认脚本存在
ls -la scripts/hermes_coordinator.py
3. 必须使用 Hermes venv 中的 Python
/.hermes/hermes-agent/venv/bin/python3 scripts/hermes_coordinator.py ask “测试” –timeout 30
组件
文件路径 / 命令
用途说明
OpenClaw Gateway
openclaw gateway run
多渠道消息接收与路由
飞书插件
/.npm-global/bin/openclaw plugins install @larksuite/openclaw-lark
飞书消息收发
Hermes Agent
hermes / hermes acp
深度任务执行引擎
HermesCooperator
scripts/hermes_coordinator.py
任务调度与协作接口
ACP 协议
Agent Client Protocol
OpenClaw ↔ Hermes 通信标准
Cron 调度
openclaw cron add
定时任务自动化
协作模式速查
任务类型
推荐方式
超时建议
简单提问
ask
30-60s
代码开发
delegate –type coding
120-300s
深度研究
delegate –type research
300-600s
定时任务
openclaw cron
按需
并行多任务
HermesScheduler
按优先级
- 🦞 OpenClaw 官方文档
- 🦞 OpenClaw GitHub
- ☤ Hermes Agent 官方文档
- ☤ Hermes GitHub
- 📖 ACP 协议规范
- 🧰 ClawHub 技能市场(13,729+ 技能)
- 🔌 MCP Servers 生态

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/283195.html