Hermes Agent 架构总览
一句话
Hermes 是一个个人 AI 操作系统。 同一个 agent core 跑在 CLI、Telegram、Discord、Cron、ACP、TUI、Desktop 等十几种 surface 上。
本地源码
text
路径: /home/ubuntu/work/hermes-agent
HEAD: 5ecf3bf0e fix(slack): report ext-matched audio mimetype
版本: 0.17.0
语言: Python + TypeScript UI代码规模
| 路径 | Python 文件 | 行数 |
|---|---|---|
run_agent.py | 1 | 5,568 |
agent/ | 117 | 75,096 |
tools/ | 106 | 83,153 |
gateway/ | 62 | 68,809 |
hermes_cli/ | 184 | 142,820 |
cron/ | 9 | 5,722 |
plugins/ | 172 | 96,929 |
调用链
CLI / Gateway / Cron / ACP / TUI / Desktop
↓
AIAgent
↓
build_turn_context() — 每轮 prologue
↓
conversation_loop.run_conversation() — 核心循环
↓
ProviderTransport / OpenAI SDK — LLM 调用
↓
assistant tool_calls
↓
tool_executor — 工具执行
↓
model_tools → tools.registry
↓
SessionDB / memory / skills / plugins / platform delivery核心设计理念
- Narrow waist:
AIAgent + tools + stable system prompt是所有 surface 的窄腰 - Prompt cache sacred:system prompt 构建一次、每轮复用
- Core narrow, capability at edges:核心工具门槛高,能力通过 plugins/skills 扩展
- Gateway 多平台:同一个 core 被 Telegram/Discord/Slack 等复用
- Self-improving:memory + skills 形成闭环
关键文件索引
| 关注点 | 文件 |
|---|---|
| CLI 入口 | hermes_cli/main.py |
| Agent 核心 | run_agent.py |
| Agent 初始化 | agent/agent_init.py |
| 对话循环 | agent/conversation_loop.py |
| 工具注册 | tools/registry.py |
| 工具执行 | agent/tool_executor.py |
| Session DB | hermes_state.py |
| Gateway | gateway/run.py |
| Plugin | hermes_cli/plugins.py |
| Cron | cron/jobs.py |