跳到正文

6 phases · 20 chapters · Python first

Learn Harness

从一次真实的 gpt-5.4 calculator tool call 开始。每章只加入一个由失败场景挣来的能力, 最后得到支持文件、Shell、Skills、Session、Subagent 与真实 MCP 的完整 Harness。

第一章先证明循环成立

不是 fake model,也不是打印预设答案。Replay 与 live 共用同一条消息和工具执行链。

steps=2 · tool_calls=1
  1. user要求使用 calculator 计算表达式
  2. model返回结构化 tool call 与 arguments
  3. toolHarness 校验并执行 23 * 7 + 5
  4. result带原 call id 回传 value: 166
  5. final模型读取结果后给出最终回答
course/p01/s01-agent-loopreplay
$ uv run python .../main.py
{"kind":"model_request","step":1,"tools":1}
{"kind":"tool_call","name":"calculator"}
{"kind":"tool_result","ok":true}
{"kind":"model_request","step":2,"tools":1}
{"kind":"final","steps":2,"tool_calls":1}

课程地图

Phase 决定学习顺序。每一阶段都留下可运行的产出。

6 phases / 20 chapters
  1. 01Phase 1 · 先让 Agent 真正跑起来真实模型调用、calculator tool call、registry 与文件工具2 课Python 3.11,了解 HTTP 与 JSON 约 80 分钟 + 深挖 30 分钟
  2. 02Phase 2 · 执行必须有边界受控 Shell、permission、hook 与可见计划3 课完成一次完整 tool call 约 100 分钟 + 深挖 45 分钟
  3. 03Phase 3 · 上下文是一套系统Subagent、真实 Skills、压缩、记忆与 system prompt5 课理解 registry 与 permission 约 160 分钟 + 深挖 80 分钟
  4. 04Phase 4 · 长任务要能恢复损坏恢复、任务图、后台执行、session 与 steering4 课理解消息历史与上下文预算 约 185 分钟 + 深挖 70 分钟
  5. 05Phase 5 · 从单 Agent 到协作系统Team、协议、自治循环与 worktree 隔离4 课能持久化并恢复一个 session 约 160 分钟 + 深挖 70 分钟
  6. 06Phase 6 · 接入协议,收束成产品真实 MCP stdio 与完整 capstone2 课完成前五个 phase 约 90 分钟 + 深挖 30 分钟