77 / 90

第77日: 統合復習 - 状態、リトライと障害分類

今週の語彙を記憶から想起し、注入された全障害を分類し、トレースに基づく事後検証を作成する。

エージェント 480 アクティブ分(8 時間)
01 120 分

検索想起ドリル: 実行状態と実行制限の語彙

Agent支援エンジニアリングチェック

前提条件

第76日の状態・リトライ機構。第73〜75日のツールプロトコル。

学習目標

今週の制御語彙(ステップ予算、リトライ予算、トレース、終了理由、チェックポイント、冪等副作用、使い捨てワークスペース)を閉ブックで想起し、記憶の感触ではなくコードと照合して検証する。

手順

1. 閉ブック: max_steps, max_retries, trace, termination, checkpoint, idempotent effect, disposable workspace 各項目を1行で定義します。
2. 権威ある定義で自己採点します: project.json の controls(max_steps=6, max_retries=2, tool_payload_bytes=4096)、agent.py の RunResult フィールド、cli.py の TemporaryDirectory ワークスペース。
3. 曖昧だった語彙を記録し、翌日の想起対象にします(分散想起は再読に勝ります)。
4. 紛らわしい対を区別します: リトライ予算(許容する失敗観測数)とステップ予算(許容する総反復数)。チェックポイント(再開を可能にする永続状態)とトレース(記録そのもの)。タイムアウト(1つのブロッキング待機)とデッドライン(エンドツーエンドの上限)。

演習と予測記録

参照リストを開く前に手書き定義を7点満点で採点してください。全ての誤答を想起キューに記録します。

独立習得基準

7つ全ての定義を無支援で記述し、コード確認前に正直に自己採点できる。最低6/7。

公式ソースリソースと権利証跡

linking CC BY-NC-ND 4.0 noncommercial no-derivatives

Site Reliability Engineering, Chapter 22: Addressing Cascading Failures

著者・提供機関: Mike Ulrich, in Site Reliability Engineering (eds. Betsy Beyer, Chris Jones, Jennifer Petoff, Niall Richard Murphy; Google) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: 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)
Release It! (Michael Nygard) - Stability patterns ↗ compared_alternative [Commercial book]

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.

linking Amazon Web Services site content / linked reference noncommercial

Exponential Backoff And Jitter

著者・提供機関: Marc Brooker, AWS Architecture Blog | オリジナル出所URL ↗

該当セクション・タイムスタンプ: 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)
Google Cloud retry strategy documentation ↗ compared_alternative [CC BY 4.0 / documentation terms]

Product-scoped truncated exponential backoff recipe; Brooker's analysis explains why jitter matters, not just what to configure.

Polly resilience library retry policies (.NET) ↗ compared_alternative [BSD-3-Clause]

Library implementation reference; the AWS article supplies the comparative evidence (with/without jitter) that anchors the lesson.

02 120 分

障害分類ドリル: 注入された全障害を分類する

独立習得チェック(AI 支援なし)

前提条件

第76日の3障害モード実行結果。

学習目標

観測された各障害を「リトライで訂正済」「リトライ予算枯渇」「ステップ予算枯渇」に分類し、各結果を強制したカウンタを特定する。

手順

1. 分類表を作成します(列: fault | observation error | 消費カウンタ | status | termination | 分類)。
2. 実実行の行: invalid_arguments('../outside.txt' 拒否、retries=1、その後訂正)-> リトライで訂正済。missing_note(not_found x3、retries=3 > 2)-> リトライ予算枯渇 tool_failure。loop(同一 list_notes x6、retries=0)-> ステップ予算枯渇。サイズ超過 write_report(>4096バイト -> size_limit)-> ペイロードを縮小して初めてリトライ可能。
3. 一過性 vs 永続: invalid_arguments、not_found、size_limit は同一引数では永続的です。盲目リトライは浪費であり、アダプタが次アクションを訂正したからこそリトライが有効でした。
4. 本番への写像: 一過性障害(タイムアウト、503)のみがバックオフ付き盲目リトライを正当化します。永続障害は訂正かデュープが必要です(Stripe の冪等リプレイは失敗リトライではありません)。

演習と予測記録

4行の分類表を完成させ、仮想的な network_timeout 障害の分類と終了状態を予測し、カウンタで根拠を示してください。

独立習得基準

障害記述だけから終了状態と消費される予算を予測し、実実行で検証できる。

公式ソースリソースと権利証跡

linking Amazon Web Services site content / linked reference noncommercial

Exponential Backoff And Jitter

著者・提供機関: Marc Brooker, AWS Architecture Blog | オリジナル出所URL ↗

該当セクション・タイムスタンプ: 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)
Google Cloud retry strategy documentation ↗ compared_alternative [CC BY 4.0 / documentation terms]

Product-scoped truncated exponential backoff recipe; Brooker's analysis explains why jitter matters, not just what to configure.

Polly resilience library retry policies (.NET) ↗ compared_alternative [BSD-3-Clause]

Library implementation reference; the AWS article supplies the comparative evidence (with/without jitter) that anchors the lesson.

linking Stripe site content / linked reference noncommercial

Stripe API Documentation: Idempotent Requests

著者・提供機関: Stripe, Inc. | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Idempotent requests (Idempotency-Key header; keys can be removed after at least 24 hours)

検証バージョンと日付: Stripe API documentation (Verified: 2026-10-30)

選定理由:

Standard production definition of idempotency keys: Stripe guarantees safe client retries by deduplicating POST requests on a caller-supplied key, the exact mechanism that turns at-least-once retries into effectively-once effects.

ソース前提知識:

HTTP APIs, retries, and side-effect semantics.

安全フォールバック(オフライン回復性):

Idempotency semantics are demonstrated locally with repeated write_report calls and a sha256 dedupe key, no Stripe account needed.

比較対象候補リソースと選定評価 (2)
IETF draft: The Idempotency-Key HTTP Header Field ↗ compared_alternative [IETF Trust / open access]

Standardization-track header specification; Stripe's live documentation is the more concrete deployed example.

AWS Builder's Library: Making retries safe with idempotent APIs ↗ compared_alternative [Amazon site content]

Deep design treatment of idempotent server design; Stripe provides the tighter client-visible contract cited in the exercise.

03 120 分

非難なき事後検証: スタックループ実行

Agent支援エンジニアリングチェック

前提条件

第77日アクティビティ2の分類。トレース検査。

学習目標

ループ障害実行の非難なき事後検証を書く: トレースから再構築したタイムライン、正確な予算計算、寄与原因、検証可能な防止アクション項目。

手順

1. SRE ポストモーテム構造: Summary, Impact, Root cause, Timeline(トレース1ステップ1行), What went well, Action items。
2. 事実のみ: 同一の list_notes アクション6回。エラー観測0件。retries は0のまま。実行はステップ6で budget_exhausted/step_budget 終了。report.txt は生成されず。
3. 寄与原因: アダプタ fault='loop' は履歴を無視して list_notes を再送出。run_task に重複アクション検出や進捗検出がない。
4. アクション項目は検証可能にします: 「連続k回の同一アクションを検出して中断」「evaluate() でツール多様性を採点」。「モデルを賢くする」は不可。
5. 非難はしません: システムは設計された範囲内の浪費(6ステップ後に安全終了)をそのまま許容しました。

演習と予測記録

トレースのステップ番号を引用した postmortem.md を作成してください(例:「ステップ1-6: list_notes が同一の files リストで ok を返した」)。全主張はトレースステップか設定定数を引用すること。

独立習得基準

全主張が記録ステップか宣言定数に紐付く事後検証を提出できる。推測ゼロ。

公式ソースリソースと権利証跡

linking CC BY-NC-ND 4.0 noncommercial no-derivatives

Site Reliability Engineering, Chapter 15: Postmortem Culture: Learning from Failure

著者・提供機関: John Lunney and Sue Lueder (ed. Gary O'Connor), in Site Reliability Engineering (eds. Betsy Beyer, Chris Jones, Jennifer Petoff, Niall Richard Murphy; Google) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Chapter 15: blameless postmortems, trigger conditions, action items

検証バージョンと日付: O'Reilly 2016 free online edition (Verified: 2026-10-30)

選定理由:

Standard blameless post-mortem structure (summary, impact, root cause, timeline, action items) applied to the bounded agent's stuck-loop run.

ソース前提知識:

Incident timelines, root-cause analysis, and action items.

安全フォールバック(オフライン回復性):

A complete post-mortem template is embedded in the lesson; learners need only the recorded trace to fill it.

比較対象候補リソースと選定評価 (2)
Etsy Code as Craft: Blameless PostMortems ↗ compared_alternative [Blog content / linked reference]

Facilitation guide for live debriefs; the SRE chapter provides the written artifact structure the exercise reproduces.

Atlassian Incident Postmortem templates ↗ compared_alternative [Vendor site content]

Product-oriented templates; the SRE chapter emphasizes evidence-linked claims, which matches the trace-backed drill.

linking CC BY-NC-ND 4.0 noncommercial no-derivatives

Site Reliability Engineering, Chapter 22: Addressing Cascading Failures

著者・提供機関: Mike Ulrich, in Site Reliability Engineering (eds. Betsy Beyer, Chris Jones, Jennifer Petoff, Niall Richard Murphy; Google) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Triggering Conditions for Cascading Failures

検証バージョンと日付: 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)
Release It! (Michael Nygard) - Stability patterns ↗ compared_alternative [Commercial book]

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.

04 120 分

統合・評価復習: 境界付き実行の証拠パック

独立習得チェック(AI 支援なし)

前提条件

第76〜77日の全アクティビティ。

学習目標

今週の証拠パック(新規CLI実行成果物、障害分類表、遷移監査出力、正直な習得チェックリスト)を組み立て、レビュアーがクリーンな環境で再現可能にする。

手順

1. 全てを再生成します: 新しい一時ディレクトリで CLI evaluate を再実行。3つの障害アダプタを再実行。遷移監査を再実行。
2. evidence_pack.json を組み立てます: {run_report, taxonomy_table, audit_rows, checklist}。
3. チェックリスト項目(met/not-met を正直に記入): 3つの終了状態を挙げる。チェックポイント化プレフィックスをリプレイする。各障害を分類する。冪等な書き込みを説明する。リトライポリシーを制限する。kill境界を正直に述べる。
4. 再現可能な成果物のない主張は not-met のままにします。それは失敗ではなく正直な復習です。

演習と予測記録

evidence_pack.json と、レビュアーが2分以内に全成果物を再生成できる README コマンド一覧を作成してください。

独立習得基準

レビュアーが記載コマンドを再実行して全主張を再現できる。記憶からの断言はゼロ。

公式ソースリソースと権利証跡

linking PSF License Version 2

Python Standard Library: subprocess - Subprocess Management

著者・提供機関: Python Software Foundation | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Using the subprocess Module (subprocess.run timeout) and Notes: Timeout Behavior

検証バージョンと日付: Python 3.13 documentation (Verified: 2026-10-30)

選定理由:

Normative reference for subprocess.run(timeout=...), TimeoutExpired, DEVNULL stdin, and the documented kill scope: timeout terminates the child process; it does not define process-tree cleanup semantics.

ソース前提知識:

Processes, arguments, exit codes, and context managers.

安全フォールバック(オフライン回復性):

The kill-boundary experiment runs entirely in the standard library, so the documented semantics are exercised offline.

比較対象候補リソースと選定評価 (2)
POSIX standard: process creation and termination ↗ compared_alternative [IEEE/Open Group standard]

Formal POSIX semantics; the Python docs map directly onto the commands learners type.

psutil process-tree utilities ↗ compared_alternative [BSD-3-Clause]

Third-party tree enumeration; the exercise deliberately demonstrates the stdlib boundary before reaching for helpers.

linking MIT (LangGraph project) / documentation site terms

LangGraph Persistence: Checkpoints, Threads, and State Snapshots

著者・提供機関: LangChain / LangGraph Documentation Team | オリジナル出所URL ↗

該当セクション・タイムスタンプ: N/A

検証バージョンと日付: LangGraph documentation (Verified: 2026-10-30)

選定理由:

Primary reference for agent-run checkpointing: LangGraph checkpointers persist graph state at every super-step so interrupted runs resume from the last committed snapshot, the production analogue of this project's action/observation trace.

ソース前提知識:

Agent loop fundamentals, tool calling, and JSON state serialization.

安全フォールバック(オフライン回復性):

The checkpoint/replay exercise is implemented directly against the projects/agent_learning trace JSON; no framework installation is required.

比較対象候補リソースと選定評価 (2)
Temporal Durable Execution documentation ↗ compared_alternative [MIT / documentation terms]

Temporal persists event histories for replay-based recovery of arbitrary workflows; LangGraph targets agent graphs specifically and stays closer to the learner's tool-loop mental model.

OpenAI Agents SDK session/state documentation ↗ compared_alternative [MIT / documentation terms]

Provider-scoped SDK sessions; LangGraph's explicit checkpoint model exposes the underlying state-transition semantics more transparently.