双轨导航 / Dual-Track Navigation
当前为 🧱 基础分步版(Project 2 · 第 1/3 步) · 想 5 分钟直接拿完整骨架,点这里跳 ⚡ Project 2 速通版。
1. 为什么先搭极简“单循环”,而不是一上来画 5 个 Agent? / Why Start with One Clean Loop
中文
按 2026 前沿共识(AP-05),一切可靠 Agent 的心脏都是一条克制、可观测的 Single Loop。我们先初始化极简工程并用 Pydantic 锁死工具边界:
EN
Every production harness begins with a transparent, bounded single loop. Initialize the repo and define type-safe tools with Pydantic:
1 | mkdir mini-harness && cd mini-harness |
2. 写出可追踪、带熔断的 harness/core.py / Bounded Loop with JSONL Trace
中文
注意这段 45 行底座里的三个工业级细节:① max_steps 防止模型死循环烧账单;② 工具报错不崩进程,而是作为可读提示退回给模型自纠;③ 每步写入 trace 列表,方便 Step 3 跑自动化 Eval!
EN
Three production details baked in from line one: hard max_steps caps, recoverable tool error feedback so the model self-corrects, and structured step traces for Step 3 evals:
1 | import json, time |
3. 本步验收标准 / Step 1 Exit Criteria
中文
- [ ] 用
pytest写一条单元测试:传错 JSON 参数给Tool.call(...)时返回invalid_args而不抛未捕获异常。 - [ ] 用 Mock Client 验证达到
max_steps时能优雅终止并写出trace.jsonl。
EN
- [ ] Unit test confirms invalid tool JSON returns a clean
invalid_argserror instead of crashing. - [ ] Mock loop test confirms
max_stepsterminates cleanly and logstrace.jsonl. Next: Step 2 — Progressive Skills →