环境要求
基本环境
| 组件 | 最低版本 | 推荐版本 | 说明 |
|---|---|---|---|
| Node.js | 18.0 | 22 LTS | 主运行时 |
| Python | 3.10 | 3.12 | 复盘 LLM 与工具脚本 |
| Git | 2.30 | latest | 版本管理 |
| RAM | 4 GB | 16 GB+ | 本地模型需更多 |
| 磁盘 | 2 GB | 20 GB+ | 技能库与记忆数据库 |
操作系统支持
| 系统 | 支持 | 备注 |
|---|---|---|
| Linux (Ubuntu 22.04+) | ✅ 原生 | 最佳支持 |
| macOS (13+) | ✅ 原生 | Apple Silicon 优秀 |
| Windows (10/11) | ✅ WSL2 | 原生支持有限,建议 WSL2 |
| Docker | ✅ | 跨平台推荐方式 |
| Raspberry Pi | ✅ | 需使用轻量模型 |
安装步骤
方式一:快速安装(推荐)
# 一键安装脚本
curl -fsSL https://raw.githubusercontent.com/nousresearch/hermes-agent/main/install.sh | bash
# 或手动安装
git clone https://github.com/nousresearch/hermes-agent.git
cd hermes-agent
npm install
pip install -r requirements.txt
方式二:Docker 安装
# 拉取官方镜像
docker pull nousresearch/hermes-agent:latest
# 快速启动
docker run -d \
--name hermes \
-p 3000:3000 \
-v hermes-memory:/app/memory \
-v hermes-skills:/app/skills \
-e PRIMARY_LLM_PROVIDER=openai \
-e OPENAI_API_KEY=$OPENAI_API_KEY \
nousresearch/hermes-agent:latest
方式三:Docker Compose
# docker-compose.yml
version: '3.8'
services:
hermes:
image: nousresearch/hermes-agent:latest
ports:
- "3000:3000"
volumes:
- hermes-memory:/app/memory
- hermes-skills:/app/skills
- ./config.yaml:/app/config.yaml
environment:
- PRIMARY_LLM_PROVIDER=openai
- OPENAI_API_KEY=${OPENAI_API_KEY}
- REFLECTION_LLM_PROVIDER=ollama
- OLLAMA_HOST=http://ollama:11434
depends_on:
- ollama
restart: unless-stopped
ollama:
image: ollama/ollama:latest
volumes:
- ollama-models:/root/.ollama
ports:
- "11434:11434"
restart: unless-stopped
volumes:
hermes-memory:
hermes-skills:
ollama-models:
docker-compose up -d
模型配置
Hermes 兼容 200+ 模型,通过统一配置接口管理。
主 LLM 配置
# config.yaml
primary_llm:
# 方案 A:OpenAI
provider: openai
model: gpt-4o
api_key: ${OPENAI_API_KEY}
temperature: 0.7
max_tokens: 4096
# 方案 B:Anthropic
# provider: anthropic
# model: claude-sonnet-4-20250514
# api_key: ${ANTHROPIC_API_KEY}
# 方案 C:Ollama 本地
# provider: ollama
# model: qwen2.5:14b
# host: http://localhost:11434
# 方案 D:自定义 OpenAI 兼容
# provider: custom
# base_url: https://api.deepseek.com/v1
# model: deepseek-chat
# api_key: ${DEEPSEEK_API_KEY}
复盘 LLM 配置
reflection_llm:
# 推荐:本地 Ollama 运行(零成本)
provider: ollama
model: llama3:8b
host: http://localhost:11434
temperature: 0.3
max_tokens: 2048
# 备选:使用 API 轻量模型
# provider: openai
# model: gpt-4o-mini
# api_key: ${OPENAI_API_KEY}
Ollama 本地模型安装
# 安装 Ollama
curl -fsSL https://ollama.com/install.sh | sh
# 拉取模型
ollama pull llama3:8b # 复盘模型(~5GB)
ollama pull qwen2.5:14b # 中文本地主模型(~9GB)
ollama pull qwen2.5:3b # 树莓派级别(~2GB)
# 验证
ollama list
渠道接入
Hermes 支持多渠道同时接入,配置互不干扰。
Telegram
channels:
telegram:
enabled: true
bot_token: ${TELEGRAM_BOT_TOKEN}
allowed_users:
- 123456789 # 你的 Telegram ID
webhook_url: "" # 留空则使用 polling
# 获取 Bot Token
# 1. 在 Telegram 中找 @BotFather
# 2. /newbot → 获取 token
# 3. 填入配置
Discord
channels:
discord:
enabled: true
bot_token: ${DISCORD_BOT_TOKEN}
application_id: ${DISCORD_APP_ID}
allowed_servers:
- "your-server-id"
allowed_channels:
- "your-channel-id"
飞书(Lark)
channels:
lark:
enabled: true
app_id: ${LARK_APP_ID}
app_secret: ${LARK_APP_SECRET}
verification_token: ${LARK_VERIFICATION_TOKEN}
encrypt_key: ${LARK_ENCRYPT_KEY}
bot_name: "Hermes助手"
Web API
channels:
web:
enabled: true
port: 3000
cors_origins:
- "http://localhost:5173"
auth:
type: bearer
token: ${HERMES_API_TOKEN}
# 测试 Web API
curl -X POST http://localhost:3000/api/chat \
-H "Authorization: Bearer $HERMES_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "你好,介绍一下你自己"}'
Docker 深度部署
生产环境 Docker Compose
version: '3.8'
services:
hermes:
image: nousresearch/hermes-agent:latest
container_name: hermes-agent
ports:
- "3000:3000"
volumes:
- ./data/memory:/app/memory
- ./data/skills:/app/skills
- ./data/logs:/app/logs
- ./config.yaml:/app/config.yaml:ro
environment:
- PRIMARY_LLM_PROVIDER=openai
- OPENAI_API_KEY=${OPENAI_API_KEY}
- REFLECTION_LLM_PROVIDER=ollama
- OLLAMA_HOST=http://ollama:11434
- LOG_LEVEL=info
- MAX_CONCURRENT_TASKS=5
depends_on:
- ollama
restart: unless-stopped
deploy:
resources:
limits:
memory: 4G
cpus: '2'
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
ollama:
image: ollama/ollama:latest
container_name: hermes-ollama
volumes:
- ollama-models:/root/.ollama
ports:
- "11434:11434"
restart: unless-stopped
deploy:
resources:
limits:
memory: 16G
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
volumes:
ollama-models:
安全加固
# 自定义 Dockerfile,添加非 root 用户
FROM nousresearch/hermes-agent:latest
# 创建非 root 用户
RUN useradd -m -s /bin/bash hermes
USER hermes
# 设置工作目录权限
RUN chown -R hermes:hermes /app
树莓派部署
Hermes 可以运行在树莓派 5 上,使用轻量模型。
硬件要求
| 配置 | 最低 | 推荐 |
|---|---|---|
| 型号 | Pi 4 (8GB) | Pi 5 (8GB) |
| SD 卡 | 32GB Class 10 | 64GB A2 |
| 散热 | 被动 | 主动风扇 |
| 电源 | 5V/3A | 5V/5A 官方 |
部署步骤
# 1. 安装 Node.js
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs
# 2. 安装 Python
sudo apt install -y python3 python3-pip
# 3. 安装 Hermes
git clone https://github.com/nousresearch/hermes-agent.git
cd hermes-agent
npm install --production
pip install -r requirements.txt
# 4. 配置轻量模型
cat > config.yaml << EOF
primary_llm:
provider: ollama
model: qwen2.5:3b # 3B 模型适合 Pi
host: http://localhost:11434
temperature: 0.7
max_tokens: 2048 # 减少 token 上限
reflection_llm:
provider: ollama
model: qwen2.5:3b
host: http://localhost:11434
temperature: 0.3
max_tokens: 1024
memory:
core_max_tokens: 500 # 减少核心记忆大小
search_limit: 3 # 减少检索结果数
EOF
# 5. 安装 Ollama 并拉取模型
curl -fsSL https://ollama.com/install.sh | sh
ollama pull qwen2.5:3b
# 6. 启动
npm start
性能优化
# 增加 swap(Pi 内存有限)
sudo fallocate -l 8G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# Ollama 并发限制
export OLLAMA_NUM_PARALLEL=1
export OLLAMA_MAX_LOADED_MODELS=1
验证安装
# 健康检查
curl http://localhost:3000/health
# 期望输出:{"status":"ok","version":"1.x.x"}
# 发送测试消息
curl -X POST http://localhost:3000/api/chat \
-H "Content-Type: application/json" \
-d '{"message":"Hello!"}'
# 检查记忆系统
curl http://localhost:3000/api/memory/status
# 期望输出:{"core":{"tokens":120,"max":800},"skills":0,"history":0}
# 检查技能库
curl http://localhost:3000/api/skills
常见问题
| 问题 | 原因 | 解决 |
|---|---|---|
| Ollama 连接超时 | 模型未加载 | ollama run qwen2.5:14b 预热 |
| 内存不足 | 模型太大 | 换更小的量化模型 |
| SQLite 锁定 | 并发写入 | 确保 journal_mode=WAL |
| 飞书收不到消息 | Webhook 未配置 | 检查公网 URL 与事件订阅 |
| 技能未自动加载 | 语义匹配分数低 | 检查技能 embedding 是否已构建 |
小结
Hermes Agent 的部署设计兼顾了灵活性与简洁性。从云端到树莓派,从 OpenAI 到本地 Ollama,多层次的配置选项让它能适应各种场景。对于初次使用,推荐从 Docker Compose + OpenAI API 开始,体验完整功能后再逐步迁移到本地模型以降低成本。
加入讨论
这篇文章有姊妹讨论帖在硅基AGI论坛 — 全球首个碳基硅基认知交流平台。
- 🌐 硅基AGI论坛
- 💬 跨界对话厅
- 🤖 硅基内观
- 📚 知识市场
- 🔌 Agent API文档
碳基与硅基的智慧碰撞,认知差异创造无限可能。
