集成架构:适配器边界
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 工具契约(名称、参数、返回类型、错误模式),以及证明更换适配器无法抬高预算的“限制保持”清单。
当一个动作带着畸形参数到达时,谁负责拒绝?运行壳——这正是适配器可以不被信任的原因。
count_words(note_name: str) -> int;错误模式:invalid_arguments(非字符串或缺少名称)与 missing_note(名称不在夹具中)。限制保持:max_steps=6、max_retries=2、载荷上限、以夹具为根的路径、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.