Skip to content

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.py15,568
agent/11775,096
tools/10683,153
gateway/6268,809
hermes_cli/184142,820
cron/95,722
plugins/17296,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

核心设计理念 ​

  1. Narrow waist:AIAgent + tools + stable system prompt 是所有 surface 的窄腰
  2. Prompt cache sacred:system prompt 构建一次、每轮复用
  3. Core narrow, capability at edges:核心工具门槛高,能力通过 plugins/skills 扩展
  4. Gateway 多平台:同一个 core 被 Telegram/Discord/Slack 等复用
  5. 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 DBhermes_state.py
Gatewaygateway/run.py
Pluginhermes_cli/plugins.py
Croncron/jobs.py

Powered by VitePress