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.