Ai
主页 > Ai >

2026年最新Hermes Agent部署教程:从零开始搭建你的自进化AI助手

2026-05-17 | 佚名 | 点击:

Hermes Agent 是由 Nous Research 开源的一款自进化 AI Agent,它是目前唯一内置学习循环的 Agent 系统——能够从经验中创建技能、在使用过程中持续改进、主动持久化知识,并在多会话中构建对你的深度理解。

本文将手把手带你完成 Hermes Agent 的完整部署流程。

一、Hermes Agent 核心特性

在部署之前,先了解它能做什么:

1.1 自进化学习系统

传统 Agent: 固定技能 → 执行任务 → 结束

Hermes Agent: 执行任务 → 自动创建技能 → 持续优化 → 知识积累 → 越用越聪明

1.2 多平台支持

部署环境 成本 适用场景
本地/WSL2 免费 开发测试、个人使用
$5 VPS 极低 7×24 小时在线
GPU 集群 中等 大规模任务、模型训练
Serverless (Daytona/Modal) 按需付费 休眠时几乎零成本

1.3 多平台消息接入

支持 15+ 消息平台:Telegram、Discord、Slack、WhatsApp、Signal、Matrix、Mattermost、Email、SMS、钉钉、飞书、企业微信等。

二、环境准备

2.1 系统要求

系统 支持状态 说明
Linux ? 完全支持 推荐 Ubuntu 20.04+
macOS ? 完全支持 Intel/Apple Silicon
WSL2 ? 完全支持 Windows 用户首选
Windows (原生) ? 不支持 请使用 WSL2

2.2 前置依赖

唯一必需: Git

1

2

# 检查 Git 是否安装

git --version

其他依赖自动安装:

三、快速安装(推荐)

3.1 一键安装脚本

1

curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash

脚本会自动完成:

  1. 检测并安装缺失的依赖
  2. 克隆仓库及子模块
  3. 创建 Python 虚拟环境
  4. 安装所有 Python 包
  5. 配置全局 hermes 命令
  6. 引导配置 LLM Provider

3.2 安装后启动

1

2

3

4

5

# 重新加载 shell 配置

source ~/.bashrc  # 或 source ~/.zshrc

 

# 启动 Hermes

hermes

四、手动安装(高级用户)

如需完全控制安装过程,按以下步骤操作:

4.1 克隆仓库

1

2

3

4

5

6

# 克隆并拉取子模块

git clone --recurse-submodules https://github.com/NousResearch/hermes-agent.git

cd hermes-agent

 

# 如果已克隆但未拉取子模块

git submodule update --init --recursive

4.2 安装 uv 并创建虚拟环境

1

2

3

4

5

# 安装 uv

curl -LsSf https://astral.sh/uv/install.sh | sh

 

# 创建 Python 3.11 虚拟环境

uv venv venv --python 3.11

4.3 安装 Python 依赖

1

2

3

4

5

6

7

8

# 设置虚拟环境变量

export VIRTUAL_ENV="$(pwd)/venv"

 

# 安装完整版(推荐)

uv pip install -e ".[all]"

 

# 或按需安装特定功能

uv pip install -e ".[messaging,cron,mcp]"

可选功能包:

功能包 说明 安装命令
all 全部功能 uv pip install -e ".[all]"
messaging Telegram/Discord uv pip install -e ".[messaging]"
cron 定时任务 uv pip install -e ".[cron]"
mcp MCP 协议支持 uv pip install -e ".[mcp]"
voice 语音模式 uv pip install -e ".[voice]"
modal Modal 云执行 uv pip install -e ".[modal]"

4.4 安装 Node.js 依赖(可选)

1

npm install

如需浏览器自动化和 WhatsApp 桥接功能,需要执行此步骤

4.5 创建配置目录

1

2

3

4

5

6

7

8

# 创建目录结构

mkdir -p ~/.hermes/{cron,sessions,logs,memories,skills,pairing,hooks,image_cache,audio_cache,whatsapp/session}

 

# 复制示例配置

cp cli-config.yaml.example ~/.hermes/config.yaml

 

# 创建环境变量文件

touch ~/.hermes/.env

4.6 配置 API 密钥

编辑 ~/.hermes/.env:

1

2

3

4

5

6

7

8

9

10

# 必需:至少配置一个 LLM Provider

OPENROUTER_API_KEY=sk-or-v1-your-key-here

# 或

OPENAI_API_KEY=sk-your-key-here

# 或

NOUS_API_KEY=your-nous-key

# 可选:增强功能

FIRECRAWL_API_KEY=fc-your-key        # 网页搜索与抓取

FAL_KEY=your-fal-key                 # 图像生成 (FLUX)

ELEVENLABS_API_KEY=your-key          # 高级语音合成

4.7 添加到 PATH

1

2

3

4

5

6

7

8

9

10

11

12

13

# 创建本地 bin 目录

mkdir -p ~/.local/bin

 

# 创建软链接

ln -sf "$(pwd)/venv/bin/hermes" ~/.local/bin/hermes

 

# 添加到 PATH(Bash)

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc

source ~/.bashrc

 

# 或 Zsh

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc

source ~/.zshrc

五、配置与验证

5.1 配置 LLM Provider

1

2

# 交互式选择模型

hermes model

支持的 Provider:

5.2 验证安装

1

2

3

4

5

6

7

8

9

10

11

# 检查版本

hermes version

 

# 运行诊断

hermes doctor

 

# 查看配置状态

hermes status

 

# 测试对话

hermes chat -q "Hello! 你有哪些可用工具?"

5.3 常用命令速查

1

2

3

4

5

6

7

8

hermes                    # 启动交互式 CLI

hermes model              # 切换模型

hermes tools              # 配置工具

hermes config set         # 设置配置项

hermes setup              # 运行完整配置向导

hermes gateway            # 启动消息网关

hermes update             # 更新到最新版

hermes doctor             # 诊断问题

六、消息网关配置(可选)

6.1 配置 Telegram Bot

1

2

3

4

5

# 1. 在 Telegram 中找到 @BotFather,创建新 Bot,获取 Token

# 2. 配置 Hermes

hermes gateway setup

 

# 选择 Telegram,输入 Bot Token

6.2 启动网关

1

hermes gateway start

现在你可以从 Telegram 与 Hermes 对话,同时它可以在云端 VM 上执行任务。

七、Docker 部署

7.1 使用 Docker Compose

1

2

3

4

5

6

7

8

9

10

11

12

13

14

version: '3.8'

services:

  hermes:

    image: nousresearch/hermes-agent:latest

    container_name: hermes

    volumes:

      - ~/.hermes:/root/.hermes

      - ./workspace:/workspace

    environment:

      - OPENROUTER_API_KEY=${OPENROUTER_API_KEY}

    ports:

      - "8080:8080"

    stdin_open: true

    tty: true

1

docker-compose up -d

7.2 使用 Dockerfile 自定义构建

1

2

3

4

5

6

7

8

9

FROM nousresearch/hermes-agent:latest

 

# 复制自定义配置

COPY ./custom-config.yaml /root/.hermes/config.yaml

 

# 安装额外依赖

RUN pip install some-extra-package

 

ENTRYPOINT ["hermes"]

八、Serverless 部署(Daytona/Modal)

8.1 为什么用 Serverless?

8.2 Modal 部署

1

2

3

4

5

6

7

8

# 安装 Modal 支持

uv pip install -e ".[modal]"

 

# 配置 Modal Token

modal token new

 

# 部署

hermes deploy modal

8.3 Daytona 部署

1

2

# 配置 Daytona

hermes deploy daytona

九、常见问题排查

9.1 安装问题

Q: 安装脚本执行失败?

1

2

3

4

5

6

# 检查网络连接

ping github.com

 

# 使用代理

export https_proxy=http://your-proxy:port

curl -fsSL ... | bash

Q: Python 版本不兼容?

1

2

# 确保使用 Python 3.11

uv venv venv --python 3.11

9.2 运行时问题

Q: 提示 API Key 无效?

1

2

3

4

5

# 检查环境变量

cat ~/.hermes/.env

 

# 重新设置

hermes config set OPENROUTER_API_KEY your-key

Q: 工具无法使用?

1

2

3

4

5

# 检查工具配置

hermes tools

 

# 运行诊断

hermes doctor

9.3 性能优化

内存优化:

1

2

3

4

# ~/.hermes/config.yaml

memory:

  max_context_tokens: 8000

  summarize_threshold: 6000

GPU 加速(如有):

1

2

# 使用 GPU 运行

hermes config set use_gpu true

十、最佳实践

10.1 安全配置

1

2

3

4

5

# 启用命令审批(生产环境推荐)

hermes config set require_approval true

 

# 设置授权密码

hermes config set auth_password your-secure-password

10.2 备份策略

1

2

3

4

5

# 备份配置和记忆

tar -czf hermes-backup-$(date +%Y%m%d).tar.gz ~/.hermes/

 

# 定期备份 Skill

cp -r ~/.hermes/skills ./skills-backup

10.3 升级维护

1

2

3

4

5

6

7

8

# 检查更新

hermes update check

 

# 执行更新

hermes update

 

# 更新后验证

hermes doctor

十一、进阶功能

自定义 Skill 开发

1

2

3

4

5

6

7

8

9

10

# ~/.hermes/skills/my_skill.py

from hermes.skill import Skill

 

class MySkill(Skill):

    name = "my_skill"

    description = "My custom skill"

     

    async def run(self, query: str):

        # 实现你的逻辑

        return {"result": f"Processed: {query}"}

MCP 集成

1

2

# 配置 MCP 服务器

hermes config set mcp_servers '[{"name": "filesystem", "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/dir"]}]'

定时任务

1

2

# 设置每日报告

hermes cron add "0 9 * * *" "生成昨日工作总结并发送到 Telegram"

十二、总结

Hermes Agent 不仅仅是一个 AI 助手,它是一个会成长的数字伙伴。随着使用时间的增加,它会:

部署只是开始,真正的魔法在于日常使用中的持续进化。

原文链接:
相关文章
最新更新