75 / 90

Day 75:故障反馈、有界修复与独立验证的结果

注入有文档的故障、观察结构化错误反馈、演练受控修复路径,并用独立评分器验证结果——不收集隐藏的思维链。

Agent(智能体) 480 分钟有效研习(8 小时)
01 120 分钟

受控修复路径:invalid_arguments 反馈后的恢复

Agent 辅助工程检查

前置要求

Day 74 的验证分层;确定性适配器的故障模式。

学习目标

运行注入的 invalid_arguments 故障,观察结构化错误观察,确认适配器在重试预算内恢复为一次完成且经外部验证的运行。

操作指引

1. 在 REPL 中于 tempfile 工作区内以 DeterministicModelAdapter(fault="invalid_arguments") 与 AgentConfig(max_steps=6, max_retries=2) 运行任务。
2. 第 1 步提案 read_note 且 filename 为 ../outside.txt;basename 规则拒绝:观察 {ok:false, error:invalid_arguments};retries 变为 1。
3. 下一次模型请求中,适配器依据历史(尚无成功的 list_notes)重新规划,发出 list_notes,再两次读取,最后 write_report——这就是受控修复路径:坏调用不会被静默原样重试,错误观察引导下一个动作。
4. 验证 RunResult:status completed、steps 5、retries 1、termination goal_reached;随后用 evaluate() 评分。
5. 与 Reflexion 式语言反馈对比:本适配器只重读失败观察,不保存推理文本——修复证据全部存在于 action/observation 轨迹中。

自主演练与记录

执行故障运行;记录 trace[0].observation.error、trace[1].observation.ok、steps、retries、status 与 termination;确认 report.txt 内容等于 expected_report()。

独立掌握标准

以精确计数(steps=5、retries=1、completed/goal_reached)复现修复路径,并解释为什么同一个坏调用不会被逐字重试。

权威源资源与权利证明

linking Open Access / CC BY 4.0

Reflexion: Language Agents with Verbal Reinforcement Learning

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

对应章节 / 时间戳: Section 2 & 3 (Reflexion Architecture and Memory Buffer)

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

入选理由:

Rigorous framework analyzing dynamic error feedback, memory buffering of execution failures, and controlled self-reflection loops without updating model weights.

来源前置条件:

Reinforcement learning concepts, agent evaluation loops, and error feedback handling.

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

Error recovery state diagrams and retry budget algorithms are detailed in curriculum materials.

对比候选资源与选型分析 (2)

Single-turn generative text refinement; Reflexion operates across multi-turn external environment action-observation failures.

Domain-specific LLM-based agent for open-world Minecraft; Reflexion establishes domain-general verbal feedback control loops.

linking Open Access / CC BY 4.0

ReAct: Synergizing Reasoning and Acting in Language Models

作者 / 机构: Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, Yuan Cao | 原始出处链接 ↗

对应章节 / 时间戳: Section 3 & 4 (ReAct Formulation and Synergy)

验证版本与日期: ICLR 2023 / arXiv:2210.03629v2 (Verified: 2026-10-30)

入选理由:

Foundational academic paper introducing the interleaved Thought-Action-Observation control loop in LLM agents, establishing formal interleaving of task reasoning and external tool execution.

来源前置条件:

Prompt engineering, token generation basics, and conversational interaction loops.

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

Complete algorithmic step traces, state loop diagrams, and control loop pseudocode are self-contained in curriculum materials.

对比候选资源与选型分析 (2)

Pure reasoning without environmental actions or external tool grounding; ReAct extends reasoning into an interactive environment action-observation loop.

Early neuro-symbolic modular router concept; ReAct offers simpler, prompting-native action-observation loop dynamics suitable for standard API models.

02 120 分钟

安全终止:missing_note 与 loop 故障的预算

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

前置要求

Day 75 活动 1:重试计数器及其预算。

学习目标

独立演示两种非目标终止:重试溢出导致的 tool_failure(missing_note 故障)与步数预算耗尽(loop 故障),并说明无限重试为何不安全。

操作指引

1. fault="missing_note":适配器总是提案 read_note missing.txt;每次观察都是 not_found;AgentConfig(max_steps=4, max_retries=1) 下第二次失败使 retries 变为 2 > 1:status failed、termination tool_failure,且不存在 report.txt。
2. fault="loop":适配器永远提案 list_notes;AgentConfig(max_steps=2, max_retries=1) 下恰好 2 步后结束:status budget_exhausted、termination step_budget。
3. 把两次运行列成表:status、steps、retries、termination、report.txt 是否存在。
4. 用两句话说明有限步数/重试预算为何重要:无界循环会把卡住的策略变成无界成本;预算把挂死转化为结构化、可检查的终止。
5. 此处为独立掌握检查——无协助运行并列表。

自主演练与记录

完成两次故障运行并填四列表(status、steps、retries、termination);验证两个工作区中均无 report.txt。

独立掌握标准

无协助复现两种终止及正确计数,并用两句话说明重试与步数预算必须有限的理由。

权威源资源与权利证明

linking Anthropic PBC copyright (no open license stated) / linked reference Linking only; no documentation text is copied

Anthropic Tool Use (Function Calling) Implementation Guide

作者 / 机构: Anthropic PBC | 原始出处链接 ↗

对应章节 / 时间戳: Tool Use Overview, Schema Definitions, and Stop Reasons

验证版本与日期: Claude API Specification (Verified: 2026-10-30)

入选理由:

Detailed production reference for client-side tool definitions, tool_use content blocks, stop reason tool_use, and tool_result response formatting.

来源前置条件:

REST API concepts, JSON schema specification, and basic Python client programming.

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

Offline mock request/response cycles and tool payload schemas are provided in the repo.

对比候选资源与选型分析 (2)
Google Gemini Function Calling Documentation ↗ compared_alternative [Creative Commons Attribution 4.0]

Protobuf and REST function declaration schema; Anthropic documentation provides explicit structured message block mechanics (tool_use / tool_result).

Cohere Tool Use and Multi-Step Agents Guide ↗ compared_alternative [Open Documentation]

Multi-step tool calling parameter definitions; Anthropic specification demonstrates clear separated content blocks essential for inspectable event traces.

linking Open Access / CC BY 4.0

Reflexion: Language Agents with Verbal Reinforcement Learning

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

对应章节 / 时间戳: Section 2 & 3 (Reflexion Architecture and Memory Buffer)

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

入选理由:

Rigorous framework analyzing dynamic error feedback, memory buffering of execution failures, and controlled self-reflection loops without updating model weights.

来源前置条件:

Reinforcement learning concepts, agent evaluation loops, and error feedback handling.

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

Error recovery state diagrams and retry budget algorithms are detailed in curriculum materials.

对比候选资源与选型分析 (2)

Single-turn generative text refinement; Reflexion operates across multi-turn external environment action-observation failures.

Domain-specific LLM-based agent for open-world Minecraft; Reflexion establishes domain-general verbal feedback control loops.

03 120 分钟

独立评分装置与可复现的评估产物

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

前置要求

Day 75 活动 1-2 的观察运行。

学习目标

用 evaluate() 按四个独立维度评分——结果、工具行为、预算、故障处理——并证明 CLI 产物是确定性的且不含思维链字段。

操作指引

1. evaluate() 会重新验证工作区:report_ok 要求文件存在且字节等于 expected_report()——外部验证,而非适配器的自我报告。
2. 四个评分维度:outcome_passed(报告产物正确)、tool_behavior_passed(每个动作名都在 ALLOWED_TOOLS 内)、budget_passed(steps <= 6 且非 budget_exhausted)、failure_handling_passed(每个错误码都是已知结构化码,且若有失败则以安全终止收尾)。
3. CLI 运行两次输出到两个文件并 diff——逐字节一致的输出才构成可复现证据。
4. 运行 python -m unittest tests.projects.test_agent_learning -v:六个测试应全部通过。
5. 扫描产物中的禁用键(thought、chain_of_thought)——轨迹策略只收集动作与观察。
6. 诚实记录模型身份:evidence.model_adapter 是 deterministic-v1,是装置替身;它对真实模型质量不作任何说明。

自主演练与记录

捕获 /tmp/agent-run.json 的 metrics 与 unittest 结果;用一行话说明每个评分维度,并解释为什么仅有进程退出码不算已验证结果。

独立掌握标准

能讲清四个评分维度、为什么进程退出码本身不等于已验证的学习证据,并说明 deterministic-v1 的局限。

权威源资源与权利证明

linking IETF Trust License / Open Standard

RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format

作者 / 机构: Tim Bray (Ed.) | 原始出处链接 ↗

对应章节 / 时间戳: Section 1-4 (JSON Syntax and Grammar)

验证版本与日期: IETF Standards Track RFC 8259 (Verified: 2026-10-30)

入选理由:

Foundational Internet standard defining strict JSON grammar, token parsing, and whitespace rules underpinning model tool calling serialization.

来源前置条件:

Text encoding, UTF-8 parsing, and serialized data exchange.

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

JSON grammar parsing rules and error recovery guidelines are documented in curriculum notes.

对比候选资源与选型分析 (2)
RFC 7049: Concise Binary Object Representation (CBOR) ↗ compared_alternative [IETF Open Standard]

Binary serialization standard; text-based LLMs operate primarily on human-readable UTF-8 JSON interchange formats.

YAML 1.2 Specification (OASIS / yaml.org) ↗ compared_alternative [Open Standard]

Indentation-sensitive text format; JSON has universally standardized parsing across language runtimes and tool schemas.

linking Apache-2.0 (specification; unrelicensed legacy contributions remain MIT) / Open Specification

Model Context Protocol (MCP) Specification

作者 / 机构: Anthropic PBC & Open Source Contributors | 原始出处链接 ↗

对应章节 / 时间戳: Architecture Overview, Transports, Tools, and Resources

验证版本与日期: MCP Specification 2024-11-05 (Verified: 2026-10-30)

入选理由:

Normative open architecture specification defining Host, Client, and Server separation, resource subscriptions, tool listing/invoking primitives, and JSON-RPC 2.0 message framing.

来源前置条件:

Client-server architecture, JSON-RPC 2.0 protocol, and standard IO communication.

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

Architectural comparison tables, loop invariants, and message frame examples are self-contained in curriculum materials.

对比候选资源与选型分析 (2)

Precursor JSON-RPC architecture for code intelligence in IDEs; MCP adapts similar client-server decoupling specifically for LLM context, tools, and prompts.

OpenAI Responses API Built-in Tools ↗ compared_alternative [Proprietary Documentation]

Hosted, vendor-managed built-in tool execution (successor to the Assistants API tools); MCP provides an open, decoupled local/remote client-server standard.

04 120 分钟

证据台账、局限性披露与计划复习

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

前置要求

Day 75 活动 1-3 的产物已保存。

学习目标

组装运行证据台账——命令、适配器身份、metrics、终止表——附明确局限性,确认所选 Agent 工具路线,并写出计划复习安排。

操作指引

1. 编写 evidence-ledger.json:命令行、fixture 名、model_adapter id、工作区策略(tempfile 工作区,绝不用仓库树)、产物中的 metrics 与产物路径。
2. 至少披露四条局限:确定性策略不是真实模型;预算与路径检查是教学控制而非操作系统沙箱;三个工具演示的是形态而非 MCP 或 tool_use 协议合规;网络在构造上被禁用,因此不存在任何服务商证据。
3. 所选路线检查:在站点打开 /你的语言/agent-track,确认所选 Agent 工具路线仍处于选中态,并记录今天方法中哪些是共享部分(循环、预算、证据),哪些是工具特定部分(命令、权限界面)。
4. 计划复习(间隔提取):明天凭记忆重新推导五个循环阶段与终止表,重跑 CLI 并对产物 diff;下周先不看笔记,重跑一个故障场景并用 evaluate() 重新评分。
5. 独立评分标准:台账中每条主张都指明其验证产物或命令;局限列表完整;任何地方都不声称真实模型能力。

自主演练与记录

编写 evidence-ledger.json、五条局限清单与计划复习检查表;台账每条主张都要引用其产物。

独立掌握标准

独立:台账能从已存产物复现 metrics,至少披露四条诚实局限,已验证所选路线,且零真实模型主张。

权威源资源与权利证明

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 | 原始出处链接 ↗

对应章节 / 时间戳: Section 2 (Approach: Tool Use and Filtering)

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

入选理由:

Original paper demonstrating self-supervised discovery and execution of tool API calls (calculator, QA, search, calendar) via inline tokenized tool invocations.

来源前置条件:

Transformer autoregressive generation, API calling syntax, and self-supervised filtering.

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

Inline tool invocation formats and self-contained mock execution traces are provided in curriculum notes.

对比候选资源与选型分析 (2)
Gorilla: Large Language Model Connected with Massive APIs (Patil et al. 2023) ↗ compared_alternative [Apache-2.0 / arXiv Open Access]

Focuses on massive API retrieval and documentation formatting; Toolformer focuses on the fundamental token-level seam between model generation and tool execution.

TALM: Tool Augmented Language Models (Parisi et al. 2022) ↗ compared_alternative [arXiv Open Access]

Iterative search-and-execute augmentation; Toolformer provides clearer self-supervised API call tokenization syntax.

linking Open Access / CC BY 4.0

Reflexion: Language Agents with Verbal Reinforcement Learning

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

对应章节 / 时间戳: Section 2 & 3 (Reflexion Architecture and Memory Buffer)

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

入选理由:

Rigorous framework analyzing dynamic error feedback, memory buffering of execution failures, and controlled self-reflection loops without updating model weights.

来源前置条件:

Reinforcement learning concepts, agent evaluation loops, and error feedback handling.

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

Error recovery state diagrams and retry budget algorithms are detailed in curriculum materials.

对比候选资源与选型分析 (2)

Single-turn generative text refinement; Reflexion operates across multi-turn external environment action-observation failures.

Domain-specific LLM-based agent for open-world Minecraft; Reflexion establishes domain-general verbal feedback control loops.