检索提取演练:运行状态与执行限制词汇
Agent 辅助工程检查
前置要求
第 76 天的状态与重试机制;第 73-75 天的工具协议。
学习目标
闭卷回忆本周控制词汇的定义——步数预算、重试预算、轨迹、终止原因、检查点、幂等副作用、一次性工作区——然后对照代码而非凭感觉验证。
操作指引
1. 闭卷:为以下各项写一行定义:max_steps、max_retries、trace、termination、checkpoint、idempotent effect、disposable workspace。
2. 对照权威定义自行批改:project.json 的 controls(max_steps=6、max_retries=2、tool_payload_bytes=4096)、agent.py 的 RunResult 字段、cli.py 的 TemporaryDirectory 工作区。
3. 记录模糊的术语,列入明天的提取计划(间隔提取胜过重读)。
4. 区分形近概念:重试预算(容忍的失败观测数)与步数预算(允许的总迭代数);检查点(使恢复成为可能的持久状态)与轨迹(记录本身);超时(单次阻塞等待)与截止时间(端到端上限)。
自主演练与记录
在查看参考答案之前,先为你的手写定义按 7 分制打分;把每个错误记入提取队列。
轨迹既是运行状态,也是审计记录;检查点是把轨迹加计数器持久化后的产物。
max_steps:循环迭代上限(6)。max_retries:触发 tool_failure 前容忍的失败观测数(2)。trace:{action, observation} 对的只追加列表。termination:运行结束的原因(goal_reached|tool_failure|step_budget)。checkpoint:使恢复成为可能的 trace+计数器持久序列化。idempotent effect:重复应用不改变状态的副作用。disposable workspace:运行后销毁的 TemporaryDirectory 夹具。
无辅助写出全部七条定义并在查代码前诚实自评;最低 6/7。
权威源资源与权利证明
Site Reliability Engineering, Chapter 22: Addressing Cascading Failures
对应章节 / 时间戳: Preventing Server Overload: Retries; Latency and Deadlines
验证版本与日期: O'Reilly 2016 free online edition (Verified: 2026-10-30)
Primary analysis of how unbounded retries amplify partial outages into cascading failures, motivating hard retry budgets and deadlines in agent runtimes.
Retries, queueing, and load-shedding basics.
The retry-amplification scenario and budget arithmetic are fully reproduced in the lesson's worked example.
对比候选资源与选型分析 (2)
Broader stability-pattern catalog (circuit breakers, bulkheads); the SRE chapter is free and directly quantifies retry amplification.
Strong companion article; the SRE chapter frames the failure mode (cascading overload) that the retry budget defends against.
Exponential Backoff And Jitter
对应章节 / 时间戳: Adding Backoff; Adding Jitter (Full Jitter, Equal Jitter, Decorrelated Jitter)
验证版本与日期: AWS Architecture Blog 2015 (Verified: 2026-10-30)
Detailed practitioner reference proving that full jitter (sleep = random_between(0, min(cap, base*2**attempt))) prevents synchronized retry storms and reduces total work during contention.
Retries, timeouts, and basic probability of correlated load.
The backoff exercise is implemented in pure Python with a local flaky stub; the derivation of jitter benefits is fully reproduced in lesson instructions.
对比候选资源与选型分析 (2)
Product-scoped truncated exponential backoff recipe; Brooker's analysis explains why jitter matters, not just what to configure.
Library implementation reference; the AWS article supplies the comparative evidence (with/without jitter) that anchors the lesson.