Hermes Agent 是由 Nous Research 开源的一款自进化 AI Agent,它是目前唯一内置学习循环的 Agent 系统——能够从经验中创建技能、在使用过程中持续改进、主动持久化知识,并在多会话中构建对你的深度理解。
本文将手把手带你完成 Hermes Agent 的完整部署流程。
在部署之前,先了解它能做什么:
传统 Agent: 固定技能 → 执行任务 → 结束
Hermes Agent: 执行任务 → 自动创建技能 → 持续优化 → 知识积累 → 越用越聪明
| 部署环境 | 成本 | 适用场景 |
|---|---|---|
| 本地/WSL2 | 免费 | 开发测试、个人使用 |
| $5 VPS | 极低 | 7×24 小时在线 |
| GPU 集群 | 中等 | 大规模任务、模型训练 |
| Serverless (Daytona/Modal) | 按需付费 | 休眠时几乎零成本 |
支持 15+ 消息平台:Telegram、Discord、Slack、WhatsApp、Signal、Matrix、Mattermost、Email、SMS、钉钉、飞书、企业微信等。
| 系统 | 支持状态 | 说明 |
|---|---|---|
| Linux | ? 完全支持 | 推荐 Ubuntu 20.04+ |
| macOS | ? 完全支持 | Intel/Apple Silicon |
| WSL2 | ? 完全支持 | Windows 用户首选 |
| Windows (原生) | ? 不支持 | 请使用 WSL2 |
唯一必需: Git
|
1 2 |
# 检查 Git 是否安装 git --version |
其他依赖自动安装:
|
1 |
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash |
脚本会自动完成:
|
1 2 3 4 5 |
# 重新加载 shell 配置 source ~/.bashrc # 或 source ~/.zshrc
# 启动 Hermes hermes |
如需完全控制安装过程,按以下步骤操作:
|
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 |
|
1 2 3 4 5 |
# 安装 uv curl -LsSf https://astral.sh/uv/install.sh | sh
# 创建 Python 3.11 虚拟环境 uv venv venv --python 3.11 |
|
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]" |
|
1 |
npm install |
如需浏览器自动化和 WhatsApp 桥接功能,需要执行此步骤
|
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 |
编辑 ~/.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 # 高级语音合成 |
|
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 |
|
1 2 |
# 交互式选择模型 hermes model |
支持的 Provider:
|
1 2 3 4 5 6 7 8 9 10 11 |
# 检查版本 hermes version
# 运行诊断 hermes doctor
# 查看配置状态 hermes status
# 测试对话 hermes chat -q "Hello! 你有哪些可用工具?" |
|
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 # 诊断问题 |
|
1 2 3 4 5 |
# 1. 在 Telegram 中找到 @BotFather,创建新 Bot,获取 Token # 2. 配置 Hermes hermes gateway setup
# 选择 Telegram,输入 Bot Token |
|
1 |
hermes gateway start |
现在你可以从 Telegram 与 Hermes 对话,同时它可以在云端 VM 上执行任务。
|
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 |
|
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"] |
|
1 2 3 4 5 6 7 8 |
# 安装 Modal 支持 uv pip install -e ".[modal]"
# 配置 Modal Token modal token new
# 部署 hermes deploy modal |
|
1 2 |
# 配置 Daytona hermes deploy daytona |
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 |
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 |
内存优化:
|
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 |
|
1 2 3 4 5 |
# 启用命令审批(生产环境推荐) hermes config set require_approval true
# 设置授权密码 hermes config set auth_password your-secure-password |
|
1 2 3 4 5 |
# 备份配置和记忆 tar -czf hermes-backup-$(date +%Y%m%d).tar.gz ~/.hermes/
# 定期备份 Skill cp -r ~/.hermes/skills ./skills-backup |
|
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 助手,它是一个会成长的数字伙伴。随着使用时间的增加,它会:
部署只是开始,真正的魔法在于日常使用中的持续进化。