
hermes-agent
Hermes Agent is an open-source, self-improving AI agent with a built-in learning loop that creates skills from experience, runs across platforms, and supports any LLM provider.
It provides a real, checkoutable Git history with incremental commits, focused tests, and failure experiments, making the learning process concrete and verifiable.
简体中文 · English
动手学 Pi
沿 15 个 checkpoint,从一条离线轨迹开始,亲手实现一个 Pi-style coding agent。
在线阅读 · 课程代码
沿 15 个可运行 checkpoint,从一条离线 Agent 轨迹出发,逐步实现:
TypeScript 协议 → 流式模型 → Provider → 工具 → Agent Loop → 会话树 → Context Compaction → 扩展 → Eval
每章由四部分闭环:教材正文 + 真实 commit + 聚焦测试 + 故障实验。课程代码不是伪代码演示,而是一条可以 checkout、运行和验证的 Git 历史。
15 个 checkpoint 沿同一条 Agent 执行链逐层推进:先建立消息与模型协议,再接入工具和循环,随后保存状态与历史,最后组合 Runtime 并用独立评测验收。
| 部分 | Checkpoint | 章节 | 这一章完成什么 | 阅读 |
|---|---|---|---|---|
| 序章 | 00 | 一次 README 读取请求怎样走完 Agent 闭环 | 跟随一次 README 请求,把用户消息、两次模型调用、工具调用与结果、最终回答连成完整闭环。 | 打开 |
| I · 模型与协议 | 01 | TypeScript 生存集:四个 DemoEvent 怎样进入测试 | 用四个 DemoEvent 串起联合类型、运行时校验、Promise 与 ESM 测试。 | 打开 |
| I · 模型与协议 | 02 | EventStream:同一个对象怎样交付下一项和最终结果 | 实现 EventStream,让事件先到与消费者先等两种时序都能交付过程项和最终结果。 | 打开 |
| I · 模型与协议 | 03 | 保存一次完整的工具往返 | 把文本、工具调用和配对结果保存为统一消息,并从模型事件收束出完整 assistant message。 | 打开 |
| I · 模型与协议 | 04 | ScriptedModel:同一个实例怎样依次播放两个回合 | 实现可重复播放预设回合的 ScriptedModel,保存请求快照并投影稳定事件流。 | 打开 |
| I · 模型与协议 | 05 | 模型调用:在课程协议和 Provider API 之间转换 | 把课程消息写成 Provider 请求,再将 SSE 响应还原为统一模型事件。 | 打开 |
| II · 工具与循环 | 06 | 工具调用:一条 echo 请求怎样变成配对结果 | 让 echo 调用经过 schema、Registry 和 executor,返回沿用原 call id 的工具结果。 | 打开 |
| II · 工具与循环 | 07 | Agent Loop:一次 README 往返怎样调用模型两次 | 实现两轮 Agent Loop:模型提出 read,工具结果写回后再生成最终回答。 | 打开 |
| II · 工具与循环 | 08 | 四个工具怎样在同一个 workspace 里完成文件任务 | 让 read、write、edit、bash 在同一 workspace 内完成受控的文件与进程操作。 | 打开 |
| III · 状态与历史 | 09 | 从单次循环到有状态 Agent | 让同一个 Agent 保存跨运行消息,并管理订阅、取消、运行中指令、follow-up 与重入。 | 打开 |
| III · 状态 |
《动手学 Pi》:沿 15 个真实 checkpoint 从零构建 Pi-style Agent
Similar projects matched by category, topics, and programming language.

Hermes Agent is an open-source, self-improving AI agent with a built-in learning loop that creates skills from experience, runs across platforms, and supports any LLM provider.

Hermex is a native SwiftUI iPhone app that lets you control a self-hosted Hermes AI agent directly from your phone, with no subscriptions, tracking, or third-party relay.

OpenClaw is a self-hosted personal AI assistant that runs on your own devices and integrates with over 25 messaging channels, featuring voice support, a live canvas, and multi-agent routing.