86 / 90

第 86 天:综合项目集成 —— 运行壳、基线与受控交付

将有界 Agent 运行壳接入所选模型适配器,重建确定性基线台账,并在一次性夹具上演练 CI 交付与故障恢复。

AI Agent 与工程实践 480 分钟有效学习时间(8 小时)
01 120 分钟

集成架构:适配器边界

Agent 辅助工程检查

前置要求

第 85 天已冻结的章程与验收契约;projects/agent_learning 源码结构。

学习目标

设计集成接缝,把已验证的运行壳(工具、预算、评分器)与所选模型适配器组合起来——恰好新增一个有界工具——且不削弱任何既有限制。

操作指引

1. 梳理 projects/agent_learning 的组件:cli.py 入口;agent.py 中带步数/重试预算与路径检查的循环;fixtures.py 一次性工作区;deterministic-v1 适配器;独立评分器。
2. 画出适配器边界:适配器只提出动作;运行壳负责校验、执行有界工具并返回结构化观测。模型绝不绕过校验。
3. 规格化新增的有界工具(例如 count_words(note_name) -> int):注册名、类型化参数、限制在夹具内的路径处理、自身的失败契约。
4. 规格化真机适配器插槽:与 deterministic-v1 相同的动作模式,由工单 23 授权契约门控;运行壳无法分辨动作来自哪个适配器——这种不透明正是接缝。
5. 撰写 integration_design.md:文本组件图、工具契约、以及“限制保持”清单(步数预算、重试预算、载荷上限、路径检查、终止条件)。

自主演练与记录

写出 count_words 工具契约(名称、参数、返回类型、错误模式),以及证明更换适配器无法抬高预算的“限制保持”清单。

独立掌握标准

产出的设计中全部控制都在运行壳侧,且无需触碰预算、路径或终止即可更换适配器。

权威源资源与权利证明

linking arXiv.org perpetual non-exclusive license / Open Access

Toolformer: Language Models Can Teach Themselves to Use Tools

作者 / 机构: Timo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Luke Zettlemoyer, Nicola Cancedda, Thomas Scialom | 原始出处链接 ↗

对应章节 / 时间戳: Sections 2-3: API-call annotation, sampling, filtering, tool integration

验证版本与日期: NeurIPS 2023 / arXiv:2302.04761v4 (Verified: 2026-10-30)

入选理由:

Primary reference for model-tool integration with explicit API contracts; informs the capstone's adapter boundary where the harness owns tool validation and the model only proposes calls.

来源前置条件:

Language-model finetuning, API calls, and tool schemas.

安全回退方案(离线弹性):

The capstone's tool contract template (name, typed arguments, error modes) is fully specified in the lesson instructions.

对比候选资源与选型分析 (2)
Yao et al.: ReAct ↗ compared_alternative [Open Access / CC BY 4.0]

Prompt-time interleaving rather than finetuned tool calls; both define the model-side of the same adapter boundary.

Large API-corpus retrieval; Toolformer's minimal single-tool mechanics match the capstone's bounded tool set.

linking All Rights Reserved (personal research blog) Prose is linked, not copied; the curriculum uses its own bounded-agent implementation

LLM Powered Autonomous Agents

作者 / 机构: Lilian Weng | 原始出处链接 ↗

对应章节 / 时间戳: Sections: planning, memory, tool use, challenges

验证版本与日期: Blog post June 23, 2023 (Verified: 2026-10-30)

入选理由:

Widely used survey mapping agent architecture components (planning, memory, tools) and their failure modes; supports the capstone integration architecture review.

来源前置条件:

Agent loops, tool use, and planning vocabulary.

安全回退方案(离线弹性):

The capstone architecture lesson specifies the adapter boundary, budgets, and tool contracts directly; no blog content is required offline.

对比候选资源与选型分析 (2)
Significant Gravitas: AutoGPT repository ↗ compared_alternative [MIT License (outside autogpt_platform/); Polyform Shield License (autogpt_platform/)]

Open-ended autonomous loop; deliberately excluded as the capstone must remain a bounded, evaluable system.

Yohei Nakajima: BabyAGI repository ↗ compared_alternative [MIT License]

Task-list autonomy demo; the survey article gives vocabulary while the capstone keeps fixed tasks and budgets.

02 120 分钟

基线复跑与证据台账

独立掌握检查(无 AI 辅助)

前置要求

第 86 天活动 1;工单 19、21、22、23 已发布的命令。

学习目标

原样复跑此前已验证的公开命令,记录任何评审者都能复现的基线台账——综合项目对照的是这份台账而非记忆。

操作指引

1. 运行确定性基线:python -m projects.agent_learning.cli evaluate --fixture summarize-notes --output /tmp/capstone-baseline.json;确认退出码 0,且产物中 expected_report_sha256 = 9e8315034af750009a4b2cfb261a077428afe441bc45c602cb7ead32ac0fd787。
2. 运行评分器测试:python -m unittest discover -s tests/projects -p 'test_agent_learning.py' -v;记录通过数。
3. 校验两份契约:python3 projects/lora/evidence/validate_contract.py 与 python3 projects/agent_learning/evidence/validate_contract.py;记录 blocked 状态保持 blocked。
4. 在 baseline_ledger.md 中逐行记录:命令、退出码、产物路径、SHA-256、环境(python3 --version)、一行观察。
5. 验证预训练证据包仍可解析:python3 -c "import json; json.load(open('curriculum/projects/docs/pretrain-cloud-evidence/evidence-package.json'))",并记录 run_status=blocked。
6. 对照:今后任何综合项目运行都必须报告相对本台账的一致或有依据的差量。

自主演练与记录

产出 baseline_ledger.md,每条命令一行(至少五行),含命令、退出码、产物 sha256 与观察;任何未能复现的行如实标记,不得改成绿色。

独立掌握标准

交付一份复现全部五条命令、附产物级证据(哈希或计数)的台账,包含诚实的失败行。

权威源资源与权利证明

linking MIT

OpenAI Evals: Framework for Evaluating LLMs and Contamination Checks

作者 / 机构: OpenAI Research | 原始出处链接 ↗

对应章节 / 时间戳: README sections 'Running evals' and 'Writing evals'

验证版本与日期: OpenAI Evals Repository (Verified: 2026-10-30)

入选理由:

Standardized evaluation repository specifying rigorous separation of eval prompts, canary GUID strings, and contamination test protocols.

来源前置条件:

Python, evaluation harnesses (MMLU, GSM8K), JSONL datasets.

安全回退方案(离线弹性):

Canary GUID matching, token set intersection, and leak detection scripts are implemented in the curriculum.

对比候选资源与选型分析 (2)
EleutherAI LM Evaluation Harness ↗ compared_alternative [MIT]

Widely adopted evaluation harness; OpenAI Evals provides explicit canary guidance and contamination check specifications.

Hugging Face Lighteval ↗ compared_alternative [MIT]

Modern lightweight eval framework; OpenAI Evals illustrates standard test-set integrity guarantees.

linking Open Access / CC BY 4.0

Reflexion: Language Agents with Verbal Reinforcement Learning

作者 / 机构: Noah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan, Shunyu Yao | 原始出处链接 ↗

对应章节 / 时间戳: Sections 3-4: self-reflection loop, episodic memory, retry budgets

验证版本与日期: NeurIPS 2023 / arXiv:2303.11366v4 (Verified: 2026-10-30)

入选理由:

Defines failure-feedback-driven retry with bounded attempts; justifies the capstone's retry budget and its distinction between corrected-in-budget and safe termination.

来源前置条件:

Agent loops, tool feedback, and retry semantics.

安全回退方案(离线弹性):

The fault-injection drill specifies verdict classes and budgets locally without needing the paper.

对比候选资源与选型分析 (2)
Yao et al.: ReAct ↗ compared_alternative [Open Access / CC BY 4.0]

Single-episode action/observation protocol; Reflexion adds the cross-attempt self-correction used in the recovery drill.

External-tool critiquing loop; Reflexion's verbal-feedback retry is simpler to bind to the capstone's retry budget.

03 120 分钟

受控交付:CI 检查与回滚演练

Agent 辅助工程检查

前置要求

第 86 天活动 2 的基线台账;curriculum/engineering/ci_delivery_rollback 中的工单 24 练习包。

学习目标

在完全一次性的夹具内,对综合项目变更集演练工单 24 的交付纪律——分支、diff 评审、自动检查、分阶段部署、健康门禁与回滚。

操作指引

1. 运行 CI 练习流水线:python3 scripts/ci_practice_runner.py,辨认其五个阶段(clean_install、regression_exercise、conflict_resolution、controlled_deployment、health_failure_and_rollback)。
2. 为综合项目复现各阶段语义:“变更”即新增的有界工具与任务;干净安装后评分器仍须通过;故意写错的工具参数必须被检查拦下。
3. 对工具 diff 做评审练习:逐行阅读,确认预算常量未变、无新增网络调用。
4. 演练回滚:在一次性夹具中部署变更,使健康检查失败(例如评分器因 missing_note 失败),恢复已知良好的夹具状态,并记录恢复证据。
5. 撰写 delivery_log.md:阶段、命令、可观测结果、通过/失败、回滚证明——只用可观测结果,不用命令截图。

自主演练与记录

产出覆盖全部五个阶段的 delivery_log.md,并附注入回归的诊断与回滚证据(例如恢复后文件哈希等于变更前哈希)。

独立掌握标准

在一次性夹具上演示“部署→健康失败→已验证恢复”,每个阶段都有产物级证据。

权威源资源与权利证明

linking All Rights Reserved (martinfowler.com) Article is linked, not copied; pipeline practice uses the repository's own runner

Continuous Integration

作者 / 机构: Martin Fowler | 原始出处链接 ↗

对应章节 / 时间戳: Practices of Continuous Integration: Make the Build Self-Testing; Fix Broken Builds Immediately

验证版本与日期: Second edition, May 2006 (Verified: 2026-10-30)

入选理由:

Standard essay defining CI as verified mainline integration; grounds the capstone delivery rehearsal's check-before-merge and broken-build-response rules.

来源前置条件:

Version control, automated tests, and build scripts.

安全回退方案(离线弹性):

scripts/ci_practice_runner.py demonstrates each stage locally; the article is a reference, not a dependency.

对比候选资源与选型分析 (2)
Humble & Farley: Continuous Delivery (Addison-Wesley) ↗ compared_alternative [All Rights Reserved (book)]

Full deployment-pipeline book; the Fowler essay suffices for the rehearsal vocabulary while the repo runner supplies practice.

Forsgren, Humble, Kim: Accelerate / DORA State of DevOps ↗ compared_alternative [CC BY-NC-ND (reports)]

Industry metrics research; cited as background while the article supplies the operative CI definition.

linking CC BY-NC-ND 4.0 noncommercial no-derivatives

Site Reliability Engineering, Chapter 8: Release Engineering

作者 / 机构: Dinah McNutt (ed. Betsy Beyer, Tim Harvey), in Site Reliability Engineering (eds. Betsy Beyer, Chris Jones, Jennifer Petoff, Niall Richard Murphy; Google) | 原始出处链接 ↗

对应章节 / 时间戳: Chapter 8: release pipeline, canarying, rollback criteria

验证版本与日期: O'Reilly 2016 / sre.google online edition (Verified: 2026-10-30)

入选理由:

Defines staged rollout, health-gated release, and rollback criteria; supplies the controlled-deployment and health-failure stages rehearsed by the capstone.

来源前置条件:

Version control, CI basics, and deployment vocabulary.

安全回退方案(离线弹性):

The CI practice runner encodes the same stages in disposable fixtures, so the exercise is self-contained.

对比候选资源与选型分析 (2)
Humble & Farley: Continuous Delivery ↗ compared_alternative [All Rights Reserved (book)]

General delivery pipeline text; the SRE chapter adds explicit rollback/health-gate criteria used by the drill.

Martin Fowler: Continuous Integration ↗ compared_alternative [All Rights Reserved]

Integration-side discipline; the SRE chapter covers the release and rollback side of the same rehearsal.

04 120 分钟

考核:故障注入与有界恢复演练

独立掌握检查(无 AI 辅助)

前置要求

第 86 天活动 1-3。

学习目标

逐一注入确定性故障(畸形参数、输入缺失、循环),验证结构化观测以预算内纠正或安全终止收场,从而证明集成系统会安全地失败。

操作指引

1. 对 {invalid_arguments, missing_note, loop} 中每个故障,启用该故障运行夹具适配器,记录动作/观测轨迹。
2. invalid_arguments:确认运行壳返回结构化错误,Agent 在 max_retries=2 内纠正或终止。
3. missing_note:确认出现结构化的 missing-note 观测,而非逃逸的异常。
4. loop:确认步数预算(max_steps=6)强制终止而非无限循环。
5. 把每个结果分类为 corrected-in-budget、terminated-safe 或 UNBOUNDED(自动判负)。在 fault_drill.json 中记录逐故障判定。
6. 最后完成一次完整恢复:从失败运行中还原干净夹具并复跑到绿——这是综合项目的受控恢复证明。

自主演练与记录

产出 fault_drill.json:对三个故障各记录轨迹指针、观测到的终止、重试次数与判定,并附以哈希验证的恢复复跑结果。

独立掌握标准

每个故障都产生结构化、有预算约束的结果,零无界逃逸,且恢复复跑经产物哈希验证。

权威源资源与权利证明

linking Open Access / CC BY 4.0

Reflexion: Language Agents with Verbal Reinforcement Learning

作者 / 机构: Noah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan, Shunyu Yao | 原始出处链接 ↗

对应章节 / 时间戳: Sections 3-4: self-reflection loop, episodic memory, retry budgets

验证版本与日期: NeurIPS 2023 / arXiv:2303.11366v4 (Verified: 2026-10-30)

入选理由:

Defines failure-feedback-driven retry with bounded attempts; justifies the capstone's retry budget and its distinction between corrected-in-budget and safe termination.

来源前置条件:

Agent loops, tool feedback, and retry semantics.

安全回退方案(离线弹性):

The fault-injection drill specifies verdict classes and budgets locally without needing the paper.

对比候选资源与选型分析 (2)
Yao et al.: ReAct ↗ compared_alternative [Open Access / CC BY 4.0]

Single-episode action/observation protocol; Reflexion adds the cross-attempt self-correction used in the recovery drill.

External-tool critiquing loop; Reflexion's verbal-feedback retry is simpler to bind to the capstone's retry budget.

linking arXiv.org perpetual non-exclusive license / Open Access

Toolformer: Language Models Can Teach Themselves to Use Tools

作者 / 机构: Timo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Luke Zettlemoyer, Nicola Cancedda, Thomas Scialom | 原始出处链接 ↗

对应章节 / 时间戳: Sections 2-3: API-call annotation, sampling, filtering, tool integration

验证版本与日期: NeurIPS 2023 / arXiv:2302.04761v4 (Verified: 2026-10-30)

入选理由:

Primary reference for model-tool integration with explicit API contracts; informs the capstone's adapter boundary where the harness owns tool validation and the model only proposes calls.

来源前置条件:

Language-model finetuning, API calls, and tool schemas.

安全回退方案(离线弹性):

The capstone's tool contract template (name, typed arguments, error modes) is fully specified in the lesson instructions.

对比候选资源与选型分析 (2)
Yao et al.: ReAct ↗ compared_alternative [Open Access / CC BY 4.0]

Prompt-time interleaving rather than finetuned tool calls; both define the model-side of the same adapter boundary.

Large API-corpus retrieval; Toolformer's minimal single-tool mechanics match the capstone's bounded tool set.