惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The GitHub Blog
The GitHub Blog
J
Java Code Geeks
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
B
Blog RSS Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Vercel News
Vercel News
腾讯CDC
博客园 - 聂微东
The Cloudflare Blog
F
Fortinet All Blogs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
Last Week in AI
Last Week in AI
B
Blog

陈少文的网站

巨变与机遇的未来十年 Kubernetes 平台管理软件压力测试方案 使用镜像部署 Hexo 静态页面 终于等到你 - GitHub 镜像仓库服务(ghcr.io) 一起来学 Go --(6)Interface 一起来学 Go --(5)Goroutine 和 Channel 什么是函数式编程 如何在 Kubernetes 集群集成 Kata 柯里化与偏函数 使用 PyGithub 自动创建 Label 软件产品是团队能力的输出 Helm 2 、Helm 3 比较 IoT 变现 Kubernetes 中的 DNS 服务 国内的 Helm 镜像源 Harbor 使用自签证书支持 Https 访问 DevOps 工具链之 Prow 如何使用 kfctl 安装 Kubeflow VS Code 无法下载 Go 插件的工具包 工程师更应具有服务精神 你不知道的 Docker 使用技巧 使用 Docker 运行 Tensorflow 论中国 什么是左移 如何清空 Git 仓库全部历史记录 一禅小和尚 有风吹过厨房 时间的玫瑰 如何在 CentOS 安装 GPU 驱动 开发 Tips(19)
容器化部署 Hermes Agent
微信公众号 · 2026-04-19 · via 陈少文的网站

1. 启动容器

  • 设置镜像
1
export IMAGE=nousresearch/hermes-agent:v2026.6.5
  • 设置目录权限
1
2
mkdir -p hermes-agent-home
chmod -R 777 hermes-agent-home
  • 设置环境变量
1
2
3
cat <<EOF > hermes-agent-home/.env
GATEWAY_ALLOW_ALL_USERS=true
EOF
  • 启动 hermes-agent
1
2
3
4
5
6
7
8
nerdctl run -d \
  --name hermes-agent \
  --restart always \
  --user hermes \
  --network host \
  -v $(pwd)/hermes-agent-home:/opt/data \
  -v $(pwd)/openclaw-home/.openclaw:/opt/data/.openclaw \
  $IMAGE gateway run
  • 启动 hermes-agent dashboard
1
2
3
4
5
6
7
nerdctl run -d \
  --name hermes-dashboard \
  --restart always \
  -p 9119:9119 \
  -v $(pwd)/hermes-agent-home:/opt/data \
  -e GATEWAY_HEALTH_URL=http://${node_IP}:8642 \
  $IMAGE dashboard --host 0.0.0.0 --insecure
  • 删除容器
1
nerdctl rm hermes-agent hermes-dashboard --force

2. 基本使用

  • 进入容器
1
nerdctl exec -it hermes-agent bash
  • 设置模型
1
/opt/hermes/.venv/bin/hermes model

这里我选择的是自定义模型 (○) 26. Custom endpoint (enter URL manually)

  • 聊天
1
/opt/hermes/.venv/bin/hermes chat -q "hi"
  • 导入 OpenClaw
1
/opt/hermes/.venv/bin/hermes claw migrate
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
┌─────────────────────────────────────────────────────────┐
│          ⚕ Hermes — OpenClaw Migration                 │
└─────────────────────────────────────────────────────────┘


◆ Migration Settings
  Source:      /opt/data/.openclaw
  Target:      /opt/data
  Preset:      full
  Overwrite:   no (skip conflicts)
  Secrets:     yes (allowlisted only)
  • 诊断
1
/opt/hermes/.venv/bin/hermes doctor
  • 进入 TUI
1
/opt/hermes/.venv/bin/hermes
  • 添加电报
1
2
echo "TELEGRAM_BOT_TOKEN=xxx
TELEGRAM_ALLOWED_USERS=xxx" >> /opt/data/.env

添加用户白名单限制。

1
/opt/hermes/.venv/bin/hermes gateway restart

3. 远程调用集成

3.1 使用 cli 调用

  • 集成逻辑

在部署机器上部署 server 提供 API ,参考 https://github.com/shaowenchen/demo/tree/master/hermes-agent-call 。server 接受到请求之后,在主机上执行如下命令:

1
nerdctl exec -it hermes-agent /opt/hermes/.venv/bin/hermes chat --yolo -c -q "巡检一下集群"

这里的 -c 参数会让每次调用保持一个会话。

  • 使用 pm2 托管服务
1
pm2 start "python3  hermes-agent-call.py" --name hermes-agent
  • 调用方式
1
curl -X POST http://127.0.0.1:3011/call -H "Content-Type: application/json" -d '{"message":"hi"}'
1
{"ok": true, "sessionid": "", "message": "hi", "command": "nerdctl exec hermes-agent /opt/hermes/.venv/bin/hermes chat --yolo -c -q \"hi\"", "exitCode": 0, "stdout": "Hey chenshaowen! 👋\nWhat can I help you with today?", "stderr": ""}

3.2 使用 OpenAI API 调用

  • 开启 OpenAI API
1
2
3
4
echo "API_SERVER_ENABLED=true
API_SERVER_HOST=0.0.0.0
API_SERVER_PORT=8643
API_SERVER_KEY=xxxx" >> /opt/data/.env
  • 重启 Hermes Agent
1
nerdctl restart hermes-agent
  • 调用方式
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
curl --location 'http://127.0.0.1:8643/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer xxx' \
--data '{
    "model": "default",
    "messages": [
        {
            "role": "user",
            "content": "你是谁?"
        }
    ],
    "temperature": 0.1,
    "max_tokens": 40960,
    "stream": false
}'

4. 查看面板

Hermes Agent 的面板,目前不能直接对话,主要用来配置和检查状态。