整合架構:適配器邊界
Agent 輔助工程檢查
前置要求
第 85 天已凍結的章程與驗收契約;projects/agent_learning 原始碼結構。
學習目標
設計整合接縫,把已驗證的執行殼(工具、預算、評分器)與所選模型適配器組合起來——恰好新增一個有界工具——且不削弱任何既有限制。
操作指引
1. 梳理 projects/agent_learning 的元件:cli.py 入口;agent.py 中帶步數/重試預算與路徑檢查的迴圈;fixtures.py 一次性工作區;deterministic-v1 適配器;獨立評分器。
2. 畫出適配器邊界:適配器只提出動作;執行殼負責驗證、執行有界工具並回傳結構化觀測。模型絕不繞過驗證。
3. 規格化新增的有界工具(例如 count_words(note_name) -> int):註冊名、型別化參數、限制在 fixture 內的路徑處理、自身的失敗契約。
4. 規格化真機適配器插槽:與 deterministic-v1 相同的動作模式,由工單 23 授權契約門控;執行殼無法分辨動作來自哪個適配器——這種不透明正是接縫。
5. 撰寫 integration_design.md:文字元件圖、工具契約、以及「限制保持」清單(步數預算、重試預算、酬載上限、路徑檢查、終止條件)。
自主實作與記錄
寫出 count_words 工具契約(名稱、參數、回傳型別、錯誤模式),以及證明更換適配器無法抬高預算的「限制保持」清單。
當一個動作帶著畸形參數到達時,誰負責拒絕?執行殼——這正是適配器可以不被信任的原因。
count_words(note_name: str) -> int;錯誤模式:invalid_arguments(非字串或缺少名稱)與 missing_note(名稱不在 fixture 中)。限制保持:max_steps=6、max_retries=2、酬載上限、以 fixture 為根的路徑、goal_reached | tool_failure | budget_exhausted 終止——全部由執行殼側強制。
產出的設計中全部控制都在執行殼側,且無需觸碰預算、路徑或終止即可更換適配器。
權威來源資源與權利證明
Toolformer: Language Models Can Teach Themselves to Use Tools
對應章節 / 時間戳: 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)
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.
LLM Powered Autonomous Agents
對應章節 / 時間戳: 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)
Open-ended autonomous loop; deliberately excluded as the capstone must remain a bounded, evaluable system.
Task-list autonomy demo; the survey article gives vocabulary while the capstone keeps fixed tasks and budgets.