面向开发者和运维工程师的 Hermes Agent 深度培训课程。
从架构原理到实战部署,覆盖源码级理解与生产环境最佳实践。
1. 课件简介
目标
- 理解 AI Agent 与传统聊天机器人的本质差异,建立正确的 Agent 思维模型
- 掌握 Hermes Agent 的三层架构设计、核心循环机制和配置系统
- 能够独立开发自定义工具、编写技能、接入新平台、部署生产环境
- 理解安全模型的多层纵深防御设计,能够在生产环境中正确配置安全策略
受众
| 角色 | 预期收益 |
|---|
| 后端开发者 | 理解 Agent 架构,开发自定义工具和技能,接入业务平台 |
| DevOps 工程师 | 掌握部署方式、监控告警、故障排查、安全配置 |
| 产品经理 / 技术负责人 | 理解 Agent 能力边界、适用场景、多平台接入方案 |
| AI 应用开发者 | 学习 Agent 设计模式、上下文管理、Prompt 工程实践 |
前置条件
- Python 3.10+:能阅读和理解 Python 异步代码
- Git:基本版本控制操作
- LLM 基础:了解 Chat Completions API、Token、Context Window 概念
- 即时通讯平台:至少拥有飞书或微信开发者账号(用于实操环节)
- Linux 基础:命令行操作、systemd 服务管理(运维模块)
课程时长
总计约 8 小时:理论讲解 4 小时 + 实操练习 4 小时
2. 目录导航
3. 学习路径建议
按角色推荐
┌──────────────────────────────────────────────────────────────────────┐
│ 全体学员(必读) │
│ 01-introduction → 02-architecture → 08-security-model │
│ 目标:建立正确的 Agent 思维模型,理解核心架构和安全基础 │
├──────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────┐ ┌─────────────────────┐ ┌──────────────┐ │
│ │ 开发者路径 │ │ 运维路径 │ │ 产品经理 │ │
│ │ │ │ │ │ 路径 │ │
│ │ 03-tool-system │ │ 10-deployment-ops │ │ │ │
│ │ 04-platform-adapters│ │ 09-advanced-features│ │ 06-skills │ │
│ │ 05-hooks-plugins │ │ 07-memory-context │ │ 04-platform │ │
│ │ 06-skills-system │ │ │ │ │ │
│ │ 07-memory-context │ │ │ │ │ │
│ │ 09-advanced-features│ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ 重点:自定义工具 │ │ 重点:部署运维 │ │ 重点:场景 │ │
│ │ 开发与平台接入 │ │ 与安全配置 │ │ 评估与集成 │ │
│ └─────────────────────┘ └─────────────────────┘ └──────────────┘ │
│ │
├──────────────────────────────────────────────────────────────────────┤
│ 所有角色:11-diagrams(随时参考)+ 12-ppt-outline(讲师备课) │
└──────────────────────────────────────────────────────────────────────┘
开发者路径(约 6 小时)
- 01-introduction(30 min):建立 Agent 思维模型
- 02-architecture(60 min):深入理解三层架构和核心循环
- 03-tool-system(60 min):掌握工具系统,完成自定义工具实操
- 04-platform-adapters(45 min):理解平台适配器,飞书接入实操
- 05-hooks-and-plugins(45 min):Hook 开发实战
- 06-skills-system(45 min):技能编写实战
- 07-memory-and-context(45 min):记忆系统和上下文压缩
- 09-advanced-features(60 min):子 Agent、Cron、浏览器自动化
运维路径(约 5 小时)
- 01-introduction(30 min):了解 Hermes Agent 基本概念
- 02-architecture(45 min):理解架构和配置系统
- 07-memory-and-context(30 min):记忆配置和上下文压缩调优
- 08-security-model(60 min):安全模型完整掌握
- 10-deployment-and-ops(90 min):部署、监控、故障排查实操
- 09-advanced-features(60 min):Cron 任务和智能路由
产品经理路径(约 3 小时)
- 01-introduction(45 min):Agent vs 聊天机器人,适用场景矩阵
- 04-platform-adapters(30 min):多平台接入能力评估
- 06-skills-system(30 min):技能系统与任务模板
- 09-advanced-features(30 min):高级特性概览(子 Agent、Cron)
- 10-deployment-and-ops(45 min):部署方案和成本评估
4. 前置条件
必备环境
| 项目 | 要求 | 验证命令 |
|---|
| Python | 3.10 或更高 | python3 --version |
| Git | 2.0+ | git --version |
| pip / uv | 最新版本 | pip --version / uv --version |
| 操作系统 | Linux / macOS | uname -a |
推荐环境(实操环节)
知识储备
- Python 异步编程:asyncio / threading 基础概念
- LLM API:Chat Completions / Token / Context Window
- YAML 配置:基本语法和环境变量展开
- Linux 运维:systemd / journalctl / Nginx 基础(运维模块)
5. 课程时长分配
理论部分(约 4 小时)
| 时段 | 时长 | 内容 | 对应章节 |
|---|
| 09:00 - 09:30 | 30 min | 认识 Hermes Agent | 01-introduction |
| 09:30 - 10:30 | 60 min | 核心架构 | 02-architecture |
| 10:30 - 10:45 | 15 min | 课间休息 | — |
| 10:45 - 11:30 | 45 min | 工具系统 | 03-tool-system |
| 11:30 - 12:00 | 30 min | 多平台接入 | 04-platform-adapters |
| 12:00 - 13:30 | 90 min | 午餐 | — |
| 13:30 - 14:15 | 45 min | Hook 与技能 | 05-hooks-and-plugins + 06-skills-system |
| 14:15 - 15:00 | 45 min | 记忆与上下文 | 07-memory-and-context |
| 15:00 - 15:15 | 15 min | 课间休息 | — |
| 15:15 - 16:00 | 45 min | 安全模型 | 08-security-model |
| 16:00 - 17:00 | 60 min | 高级特性与运维 | 09-advanced-features + 10-deployment-and-ops |
实操部分(约 4 小时)
| 时段 | 时长 | 内容 | 对应章节 |
|---|
| — | 15 min | 自定义工具开发 | 03-tool-system |
| — | 20 min | 飞书适配器配置与接入 | 04-platform-adapters |
| — | 20 min | 编写 Hook 或技能 | 05-hooks-and-plugins + 06-skills-system |
| — | 15 min | 安全配置实操 | 08-security-model |
| — | 15 min | 部署与监控实操 | 10-deployment-and-ops |
| — | 15 min | 综合练习:端到端场景 | 全部 |
实操环节可穿插在理论讲解中,或集中在课程后半段进行。
每个实操环节附有详细的步骤说明和预期结果。
6. 附录
参考资源
| 资源 | 位置 | 说明 |
|---|
| 源码仓库 | /opt/hermes-agent/ | Hermes Agent 完整源码 |
| 核心入口 | run_agent.py | AIAgent 核心引擎 |
| 工具注册 | tools/registry.py | ToolRegistry 单例 |
| 平台适配器 | gateway/platforms/ | 所有平台适配器实现 |
| 配置管理 | hermes_cli/config.py | 配置加载与解析 |
| 记忆系统 | tools/memory_tool.py | MemoryStore 实现 |
| 上下文压缩 | agent/context_compressor.py | 5 步压缩算法 |
| 安全模块 | tools/approval.py | 命令审批系统 |
| 子 Agent | tools/delegate_tool.py | 委派与并行执行 |
| Cron 调度 | cron/scheduler.py | 定时任务系统 |
社区链接
- GitHub 仓库:Hermes Agent 源码和 Issue 追踪
- 飞书群组: Hermes Agent 中文社区(培训答疑)
- Discord 频道:Hermes Agent 英文社区
源码位置速查
| 概念 | 源文件 | 关键行号 |
|---|
| AIAgent 类 | run_agent.py | 第 492 行 |
| run_conversation() | run_agent.py | 第 7506 行 |
| IterationBudget | run_agent.py | 第 170 行 |
| ToolRegistry | tools/registry.py | 第 48 行 |
| GatewayRunner | gateway/run.py | 第 510 行 |
| BasePlatformAdapter | gateway/platforms/base.py | 第 726 行 |
| SessionStore | gateway/session.py | 第 495 行 |
| HookRegistry | gateway/hooks.py | 第 34 行 |
| ContextCompressor | agent/context_compressor.py | 类定义 |
| MemoryStore | tools/memory_tool.py | 第 100 行 |
| CheckpointManager | tools/checkpoint_manager.py | 类定义 |
| DANGEROUS_PATTERNS | tools/approval.py | 第 75 行 |
| delegate_task | tools/delegate_tool.py | 工具注册 |
配置文件位置
~/.hermes/
├── .env # 环境变量(API Key 等敏感信息)
├── config.yaml # 主配置文件
├── SOUL.md # Agent 人格定义(可选)
├── BOOT.md # Gateway 启动指令(可选)
├── memories/
│ ├── MEMORY.md # Agent 长期记忆
│ └── USER.md # 用户画像
├── skills/ # 技能目录
│ └── <category>/<skill>/SKILL.md
├── hooks/ # Hook 目录
│ └── <hook-name>/HOOK.yaml + handler.py
├── sessions/ # 会话数据库(SQLite)
├── logs/ # 日志目录
├── cron/
│ └── jobs.json # 定时任务配置
├── checkpoints/ # Shadow Git 检查点
└── bin/ # 自动安装的二进制(如 tirith)