Skip to content
Jordan Hudgens
Studio illustration of four horizontal plates in slate, frosted teal glass, terracotta, and black, stacked on a dark basalt base and aligned by one vertical brass pin.AI-generated illustration
Guide 18IntermediateOperations and observabilityAgents and tool use

Operate and Debug Agents in Production

Trace one agent request across four layers, redact before export, retry without storms, and turn each incident into a regression that fails first.

Reading
28 min
Workshop
90 min
Stack
TS, Node 22, Anthropic SDK
Version
1.0.0
Last verified
Nov 30, 2026

What you will build and be able to do

Each outcome has an observable criterion. The lab and the assessment check exactly these, nothing more and nothing less.

  1. OBJ-001

    Instrument an agent across four layers

    Propagate a W3C traceparent through application, model, tool, and infrastructure spans with pinned GenAI attributes, and scrub personal data, secrets, and provider identifiers before export. Checked by pnpm test:lab1.

  2. OBJ-002

    Localize the failing layer and root-cause span

    Read a correlated waterfall from the failed outcome down to the earliest broken span instead of stopping at the visible symptom. Checked by pnpm lab2:triage.

  3. OBJ-003

    Contain faults without retry storms

    Apply header-aware retries, a spend-cap breaker, domain-keyed write idempotency, stream gating, and post-turn reconciliation. Checked by pnpm lab2:drill and pnpm test:lab2.

  4. OBJ-004

    Turn an incident into a regression

    Run a containment-first runbook, write a blameless postmortem anchored to span ids, and convert a redacted trace into a test that fails on the broken build. Checked by pnpm lab3:convert and pnpm test:lab3.

Unpack production-ops-labs.zip and run the offline checks ($0.00)

  • TypeScript on Node.js 22.12 or newer (22.23.5 tested), a terminal, and comfort reading JSON Lines logs and HTTP headers.Node.js downloads
  • The Example Outfitters support loop, tool calls, and traced runs. This guide instruments that loop.Start with Guide 01
  • System-of-record outcome grading, which tells a correct run from a plausible one.Read Guide 02
  • Write-tool containment boundaries, because every incident here ends at a write.Read Guide 03
  • Cost and latency baselines for the same service. This guide takes over once live traffic, timeouts, and stale caches arrive.Read Guide 17
  • No API key required. The labs run offline against a local fault proxy at $0.00.
Terminalbash
unzip -q production-ops-labs.zip -d production-ops-workcd production-ops-work/starter && pnpm install --frozen-lockfilepnpm peers:check && pnpm typecheckpnpm test   # most tests fail at the start, and that is the plan
Offline production operations labs and incident regression checks (MIT, ZIP) · ZIP · tested at v1.0.0

The Four-Layer Production Trace and Triage Loop

One trace id crosses four layers, and redaction runs at ingest, before any span reaches disk or a collector.
Architecture of the trace loop across the application, model, tool, and infrastructure layers, with one trace id shared by every span and redaction applied at ingest before export.
Extended description

The application layer takes the request, assembles the prompt, checks that cached policy matches the active policy version, enforces the turn budget, and reconciles the desk after the turn. The model layer records the SDK call and one child span per HTTP attempt.

The tool layer validates arguments, attaches the idempotency key, and calls the refund service. The infrastructure layer covers transport, 429 headers, 503 and 529 overload signals, and worker timeouts. You debug by starting at the failed outcome and walking down in time order.

Why HTTP 200 metrics miss agent failures

A web service treats HTTP 200 as success and 5xx as failure. An agent loop breaks that habit in three ways, and we checked each one against the live Claude API before writing the labs. Anthropic's guidance on agent evaluations separates the transcript of a trial from its outcome, the final state in the outside environment (Anthropic Engineering, checked 2026-11-30). If the agent tells a customer the refund is complete while the desk holds 0 or 9600 cents, the outcome failed even though every call returned 200.

Three ways an agent turn fails behind a 200 status
MechanismWhat the HTTP layer showsWhat actually happened
Token ceiling200 with stop_reason max_tokensOutput stopped at 16 tokens, mid-sentence, with a ceiling of 16
Thinking starvation200 with stop_reason max_tokensSonnet 5.5 with a ceiling of 48 used 48 of 48 output tokens before any visible text or tool call
Mid-stream error200 headers already sentAn overloaded_error frame arrived after 1 partial chunk and the stream never reached message_stop
Transcript divergence200 on every callThe reply promised a refund while the desk delta was 0

The stream case needs care. In the 2026-11-30 probe, the SDK threw an APIError whose status was empty and made 1 upstream attempt even with maxRetries set to 2, so a mid-stream failure is yours to catch (Claude API errors, checked 2026-11-30).

Correlate four layers with trace context

One request carries one trace id through four layers, and the standard way to carry it is the W3C traceparent header (W3C Trace Context, checked 2026-11-30). A valid version 00 header has four lowercase hexadecimal fields. Version ff, uppercase hex, an all-zero trace id, and an all-zero parent id are all invalid, so validate at intake and start a fresh trace when the header is missing or malformed.

traceparenttext
# a valid header00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01# the intake check used in Lab 1^00-(?!0{32})[0-9a-f]{32}-(?!0{16})[0-9a-f]{16}-[0-9a-f]{2}$
The four layers and what each one records
LayerOwnsTypical evidence
L1-APPIntake, prompt assembly, cache version check, reconciliationretrieval.doc_version against active_policy_version
L2-MODELSDK call and one child span per HTTP attemptstop_reason, message_stop, token usage
L3-TOOLSchema validation, outbound call, idempotency keyTool attempt count and breaker state
L4-INFRATransport, 429 headers, overload and timeoutsretry-after, 503, 529, socket timeout

Attribute names need a pin. OpenTelemetry moved the gen_ai conventions into a dedicated repository where agent and model spans remain at Development status (OpenTelemetry GenAI spans at commit 81b5d438519f, checked 2026-11-30). The labs pin that commit, validate every span with Zod, and write gen_ai.provider.name beside the legacy gen_ai.system value so a collector upgrade cannot silently rename a field.

The SDK itself needs one more step. Version 1.14.0 emits one client span per method call and no child span per HTTP attempt, so a call that retried twice looks like one long bar. Wrapping the inner fetch gives each attempt its own model and infrastructure spans and lets you record the request id and rate-limit headers from each response.

Redact at ingest, before spans touch disk

Trace pipelines become a second database of everything users type. OWASP ranks sensitive information disclosure as LLM02 for 2025 because prompts, tool arguments, and traces routinely carry personal data and credentials (OWASP LLM02:2025, checked 2026-11-30). Provider retention terms do not help here. Once your service writes a prompt, an email, or a raw request id to a file or a collector, you own that risk (Claude data retention, checked 2026-11-30).

Pipeline that scrubs secrets, personal data, and provider identifiers inside the export function before validation and disk write, then feeds a leak scanner and the incident-to-regression step.
Redaction runs inside the export function, so no unscrubbed span can reach disk.
Extended description

Spans enter the exporter, pass through three scrub steps for secrets, personal data, and provider identifiers, then pass schema validation and are written. A leak scanner reads the written file, and a resolved incident leaves the same pipeline as a regression test.

  • Secrets and headers: Authorization, x-api-key, bearer tokens, and key-shaped strings become [REDACTED:SECRET].
  • Customer personal data: emails become a keyed short hash, phone numbers and street addresses become fixed placeholders, and domain keys such as ticket and order numbers stay readable so an on-call engineer can still join the trace to the desk.
  • Provider identifiers: raw request, message, and workspace ids become deterministic HMAC pseudonyms, so two spans from one upstream request still join without exposing a real account identifier.

Walk a waterfall from symptom to root cause

Once all four layers share a trace id, debugging stops being guesswork. Start at the failed outcome span in the application layer, walk down the parent-child links in time order, and stop at the earliest span where an invariant broke. The first incident is a 48 dollar refund on a broken pole that the desk records twice.

Four-layer waterfall for the first incident with the application symptom at the top and the timed-out transport span marked as the root cause.
The symptom sits in the application layer, and the root cause sits two layers down.
Extended description

Rows run top to bottom in time order. The task span is the symptom, the first model call is clean, the refund call commits before the transport span times out, and a second refund attempt follows without a key.

pnpm lab2:triagetext
=== INC-001 ===trace a29f9786f64e6d839349cceb1fbf67e8OFFSET  DUR    LAYER     SPAN    0ms  129ms L1-APP    agent.task 96e320f8  <- symptom    1ms    1ms L3-TOOL     tool.get_order fa343e46    3ms    1ms L1-APP      app.retrieval b422e728    5ms    5ms L2-MODEL    gen_ai.chat 5bb2a12f    6ms    3ms L2-MODEL      http.attempt 1a478a35    7ms    1ms L4-INFRA        infra.transport f72313fa   11ms  109ms L3-TOOL     tool.issue_refund 05107738   12ms    3ms L3-TOOL       tool.issue_refund.attempt bb449e5c  ERROR   13ms    1ms L4-INFRA        infra.transport 0741eb7d  <- root cause FT-TOOL-TRANSIENT ERROR  116ms    3ms L3-TOOL       tool.issue_refund.attempt 7e5c3217  117ms    1ms L4-INFRA        infra.transport b0256a34  121ms    5ms L2-MODEL    gen_ai.chat d5c82f79  122ms    3ms L2-MODEL      http.attempt 8b32a138  123ms    1ms L4-INFRA        infra.transport 11756736  127ms    1ms L3-TOOL     tool.get_order.final 532e3af5root cause: infra.transport (L4-INFRA) 0741eb7df164544fsymptom:    96e320f89e0a5212class:      FT-TOOL-TRANSIENTactions:    RETRY_SAFELY, CONTAIN, ESCALATEverdict: matches expected triage contract
  • The model layer completed cleanly in one attempt and asked for one refund of 4800 cents, so editing the prompt or switching models would fix nothing.
  • The first refund attempt committed the payout, then the transport span timed out.
  • The starter retry loop sent a second attempt with no idempotency key, and the refund service recorded a second payout.
Four beats of the first incident: symptom, clean model call, committed write, keyless retry. Silent loop, 6 seconds.
Extended description

The six-second loop steps through the same trace, highlighting the task symptom, the clean model span, the committed refund before the timeout, and the second attempt that carries no key.

Across services we sort failures into eight codes so every alert maps to a first safe move. The first move is always containment or a safe retry. Durable repair comes after impact stops.

Matrix of eight production failure classes with the layer, trace signature, and first safe move for each.
Eight failure classes, each paired with a layer, a signature, and a first move.
Extended description

Each row names one failure code, the layer that owns it, the trace signature that identifies it, and the first safe move: retry safely, contain, repair, or escalate.

The eight failure classes and their first safe move
CodeLayerTrace signatureFirst safe move
FT-TOOL-TRANSIENTL3-TOOLTimeout or 5xx on a tool callRetry only with an idempotency key
FT-INFRA-RATE-TRANSIENTL4-INFRA429 with a positive retry-afterWait, then retry inside the cap
FT-INFRA-SPEND-CAPL4-INFRA429 with no retry-after or a spend-cap codeZero retries, open breaker, escalate
FT-MODEL-STREAM-DROPL2-MODELError frame after 200, no message_stopDiscard buffer, retry before any write
FT-MODEL-TRUNCATIONL2-MODEL200 with stop_reason max_tokensContain partial tool JSON, repair the budget
FT-APP-STALE-CONTEXTL1-APPCached policy older than the active oneBlock writes, invalidate cache, escalate
FT-APP-TRANSCRIPT-DIVERGENCEL1-APPReply claims a refund, desk delta is 0Withhold reply, send a safe escalation
FT-APP-REDACTION-BREACHL1-APPScanner finds raw data in the sinkContain the sink, repair the scrubber

Safe retries, spend-cap breakers, and idempotent writes

Retries save a flaky call or take down a stressed dependency. By default, version 1.14.0 of the SDK retries a failed request twice, three attempts in all, on 408, 409, 429, and 5xx responses unless the response says x-should-retry is false (Claude API errors, checked 2026-11-30). Wrap a three attempt application loop around that client and one outage becomes 3 times 3, or 9 upstream attempts.

State machine for header-aware retries: a burst 429 with retry-after waits and retries, a spend-cap 429 opens a breaker with zero retries, and three consecutive failures open the transient breaker.
Burst limits wait and retry. A spend cap opens a breaker and stops.
Extended description

Two 429 paths leave the same state. A positive retry-after of 30 seconds or less waits with jitter and retries within three attempts. A spend-cap code, a missing retry-after, or x-should-retry false makes zero retries and opens the breaker.

Upstream attempts observed in the local 429 probe, SDK maxRetries set to 2
ResponseUpstream attemptsError class
Burst 429 with retry-after3RateLimitError
Spend-cap 429, no retry-after3Spend-limit subclass of RateLimitError
Spend-cap 429 with x-should-retry false1Spend-limit subclass of RateLimitError
Live 400 invalid request1invalid_request_error

A monthly spend-cap pause returns 429 with no retry-after, and automatic retries fail until access resumes (Claude rate limits, checked 2026-11-30). The SDK retry check reads the status and x-should-retry, not the error code, so set maxRetries to 0 on the inner client and let one controller decide. Other endpoints may omit the error code on a spend-cap 429, so test the code and the missing retry-after together.

A write needs its own rule. When the refund call times out, the caller cannot know whether the ledger committed before the socket died. A key from a random value or a span id changes on every attempt, so derive it from the business facts of the operation instead.

idempotency keytext
refund:<ticket_id>:<order_id>:<amount_cents>refund:T-1042:ORD-5521:4800   # identical on attempt 1 and attempt 2

Three more guards sit above the status layer. Compare the cached policy version with the active version before enabling write tools, which catches a stale 45 day window on an order that is 38 days old. Refuse to run any tool block when the stop reason is max_tokens or message_stop never arrived. Before releasing the reply, reconcile the desk, and withhold any promise of a refund when the refunded total is 0.

Live evidence, runbooks, and regressions

After freezing the lab files we ran three live batches against the Claude API on 2026-11-30 with a local desk and refund server on 127.0.0.1, to confirm that the same schema, trace headers, and redaction hold on live multi-turn traffic. Prices were $2.00 and $10.00 per million tokens for Sonnet 5.5 and $0.10 and $0.50 for Haiku 5.5 (Claude pricing, checked 2026-11-30).

Live correlation batches recorded on 2026-11-30
BatchPassedp50 TTFTp50 totalMax totalTotal USD
Correlate, Sonnet 5.56/61,016 ms3,602 ms5,840 ms$0.068718
Correlate, Haiku 5.56/6629 ms2,909 ms4,828 ms$0.003782
Hybrid fault, Sonnet 5.52/2913 ms4,159 ms4,240 ms$0.025026

At n of 6, 6, and 2, nearest-rank p95 equals the sample maximum, so read these as one day of direction and not as service-level percentiles. All 14 trials passed the trace audit with 1 trace id per ticket, 0 orphans, and 0 leaks. Most of the wait sat in the model layer, with a median of 3,602 ms on Sonnet and 2,909 ms on Haiku, while local tool spans finished in a few milliseconds. In the hybrid batch the refund server returned a 504 after committing 4800 cents, the controller retried once with the same key, and the desk still held one payout.

Mitigation comes before repair. Site reliability guidance separates stopping impact from building the durable fix (Google SRE Workbook on incident response, checked 2026-11-30), so the first move on a spend-cap incident is to open the breaker and route tickets to a human, not to refactor the retry library. Afterward, write a short blameless postmortem about system conditions (Google SRE Workbook on postmortem culture, checked 2026-11-30). Anchor each claim to span ids and write that the tool contract allowed a retry without a key, not that someone forgot one.

A spend-cap response opens the breaker, then a redacted trace becomes a regression. Silent loop, 6 seconds.
Extended description

The six-second loop shows a spend-cap 429 producing one upstream attempt and an open breaker, then the converted regression failing on the broken outcome and passing on the repaired outcome.

An incident is not closed until its trace becomes a test. A vacuous converter asserts a 200 status or a nonempty span list, which passes on the broken code too. A useful converter extracts the invariant that broke and proves two things in continuous integration.

  1. Run the generated spec against the broken outcome. It must fail.
  2. Run the identical spec against the repaired runner. It must pass.

Limits of this evidence

  • The Example Outfitters workload is synthetic. It proves the control logic and trace correlation, not production traffic.
  • The live sample is 14 trials on one day, so a p95 is the sample maximum.
  • The spend-cap 429, the mid-stream error, and the post-commit 504 were injected through a loopback proxy, so no real organization spend cap was exhausted.
  • The idempotency store runs in one Node.js process. A multi-replica service needs a unique constraint or an atomic compare-and-set record with a retention window.
  • The GenAI conventions are at Development status, so recheck attribute names before upgrading a collector or an SDK major version.

Lab 1: Correlate traces and redact at ingest

Repair the starter telemetry so every incident forms one connected four-layer tree with a valid traceparent, and so no raw email, phone number, secret, or provider identifier reaches an exported JSON Lines file.

Acceptance checks

  • All 24 Lab 1 tests pass, including strict traceparent validation, parent links across all four layers, and the zero-leak export check for each incident.
  • The audit reports one trace per incident, zero orphan spans, and zero raw leaks.
  1. Run the Lab 1 tests

    $ pnpm test:lab1

    Initial: Initial (before you edit any file, 8 of 24 pass)

    ok 1 - traceparent accepts a valid header and round-trips ok 2 - traceparent rejects every malformed shape ok 3 - tracer adopts a valid incoming traceparent and ignores an invalid one not ok 4 - every layer links to its parent and shares one trace_id ok 5 - span ids are deterministic for a seed ok 6 - span schema pins the semantic conventions commit and validates fields ok 7 - gen_ai.provider.name and legacy gen_ai.system stay in step not ok 8 - INC-001: one connected four-layer trace and a valid traceparent on every request not ok 9 - INC-001: exported JSONL holds zero raw synthetic PII, secrets, or provider ids not ok 10 - INC-002a: one connected four-layer trace and a valid traceparent on every request not ok 11 - INC-002a: exported JSONL holds zero raw synthetic PII, secrets, or provider ids not ok 12 - INC-002b: one connected four-layer trace and a valid traceparent on every request not ok 13 - INC-002b: exported JSONL holds zero raw synthetic PII, secrets, or provider ids not ok 14 - INC-003: one connected four-layer trace and a valid traceparent on every request not ok 15 - INC-003: exported JSONL holds zero raw synthetic PII, secrets, or provider ids not ok 16 - INC-004: one connected four-layer trace and a valid traceparent on every request not ok 17 - INC-004: exported JSONL holds zero raw synthetic PII, secrets, or provider ids not ok 18 - INC-005: one connected four-layer trace and a valid traceparent on every request not ok 19 - INC-005: exported JSONL holds zero raw synthetic PII, secrets, or provider ids not ok 20 - redaction removes every planted literal and keeps domain keys not ok 21 - pseudonyms are deterministic, joinable, and salt dependent ok 22 - redaction does not mutate its input not ok 23 - export validates and redacts before serializing ok 24 - leak scanner flags each planted literal and passes pseudonyms # tests 24 # pass 8 # fail 16

    Final: Final (after every Lab 1 check passes, 24 of 24)

    ok 1 - traceparent accepts a valid header and round-trips ok 2 - traceparent rejects every malformed shape ok 3 - tracer adopts a valid incoming traceparent and ignores an invalid one ok 4 - every layer links to its parent and shares one trace_id ok 5 - span ids are deterministic for a seed ok 6 - span schema pins the semantic conventions commit and validates fields ok 7 - gen_ai.provider.name and legacy gen_ai.system stay in step ok 8 - INC-001: one connected four-layer trace and a valid traceparent on every request ok 9 - INC-001: exported JSONL holds zero raw synthetic PII, secrets, or provider ids ok 10 - INC-002a: one connected four-layer trace and a valid traceparent on every request ok 11 - INC-002a: exported JSONL holds zero raw synthetic PII, secrets, or provider ids ok 12 - INC-002b: one connected four-layer trace and a valid traceparent on every request ok 13 - INC-002b: exported JSONL holds zero raw synthetic PII, secrets, or provider ids ok 14 - INC-003: one connected four-layer trace and a valid traceparent on every request ok 15 - INC-003: exported JSONL holds zero raw synthetic PII, secrets, or provider ids ok 16 - INC-004: one connected four-layer trace and a valid traceparent on every request ok 17 - INC-004: exported JSONL holds zero raw synthetic PII, secrets, or provider ids ok 18 - INC-005: one connected four-layer trace and a valid traceparent on every request ok 19 - INC-005: exported JSONL holds zero raw synthetic PII, secrets, or provider ids ok 20 - redaction removes every planted literal and keeps domain keys ok 21 - pseudonyms are deterministic, joinable, and salt dependent ok 22 - redaction does not mutate its input ok 23 - export validates and redacts before serializing ok 24 - leak scanner flags each planted literal and passes pseudonyms # tests 24 # pass 24 # fail 0
  2. Audit the exported traces

    $ pnpm lab1:audit

    Initial: Initial (every incident splits into many traces and leaks raw data)

    incident spans traces orphans raw leaks verdict INC-001 15 14 0 14 fail expected 1 trace_id, found 14 expected 1 root span, found 14 leak email on line 1 leak phone on line 1 INC-002a 15 14 0 12 fail expected 1 trace_id, found 14 expected 1 root span, found 14 leak email on line 1 leak provider_id on line 5 INC-002b 24 22 0 28 fail expected 1 trace_id, found 22 expected 1 root span, found 22 leak email on line 1 leak provider_id on line 5 INC-003 13 12 0 9 fail expected 1 trace_id, found 12 expected 1 root span, found 12 leak email on line 1 leak provider_id on line 5 INC-004 13 12 0 9 fail expected 1 trace_id, found 12 expected 1 root span, found 12 leak email on line 1 leak provider_id on line 5 INC-005 7 6 0 5 fail expected 1 trace_id, found 6 expected 1 root span, found 6 leak email on line 1 leak provider_id on line 5 audit failed for 6 incident(s)

    Final: Final (one trace per incident, zero orphans, zero raw leaks)

    incident spans traces orphans raw leaks verdict INC-001 19 1 0 0 pass INC-002a 19 1 0 0 pass INC-002b 10 1 0 0 pass INC-003 12 1 0 0 pass INC-004 10 1 0 0 pass INC-005 19 1 0 0 pass audit passed: 1 trace per incident, 0 orphans, 0 raw leaks
  3. Show the solution discussion

    Validate the incoming header against the version 00 pattern, reject uppercase hex, version ff, and all-zero identifiers, and start a fresh trace when the header is missing or malformed.

    Give every span the parent span id of the layer above it, and write gen_ai.provider.name beside the legacy gen_ai.system value.

    Scrub secrets, personal data, and provider identifiers inside the export function before schema validation and before any write, and keep domain keys such as ticket and order numbers readable.

More labs in this guide

  • Lab 2: Localize root causes and enforce safe retries

    Rebuild the waterfall locator, own retries in one controller with a spend-cap breaker, key every write by its business facts, and gate streamed output and cached policy before anything writes.

  • Lab 3: Write postmortems and convert incidents to regressions

    Validate the containment-first runbook, generate blameless postmortems anchored to span ids, and convert each redacted incident into a regression spec that fails on the broken outcome and passes on the repaired one.

Eight ways this breaks, and how you will know

Every failure here is reproducible in the lab with a flag. Learn the symptom first; it is what you will actually see.

  • F-01pnpm lab2:drillReproducible

    A retried write with no idempotency key

    Symptom
    The desk records two refunds of 4800 cents after one timed-out tool call.
    Diagnosis
    The first attempt committed before the socket timed out, and the retry carried no key, so the service treated it as new.
    Fix
    Derive the key from ticket, order, and amount, send it on every attempt, and reject a mutating call that has none.
    Verify
    Run pnpm lab2:drill and confirm the first incident reports single-refund and keyed-writes as pass.
  • F-02pnpm lab2:drillReproducible

    Retry delay hidden inside the SDK

    Symptom
    A burst 429 recovers, but the trace shows one long model span and no wait.
    Diagnosis
    The SDK retries inside one call span, so the retry-after wait is invisible and unbounded by your controller.
    Fix
    Set the inner maxRetries to 0, honor retry-after with seeded jitter, and record each wait on its own span.
    Verify
    Run pnpm lab2:drill and confirm retry-after-honored passes with a recorded wait.
  • F-03pnpm lab2:drillReproducible

    A spend cap treated like a burst limit

    Symptom
    Nine upstream attempts fire at a spend-cap 429 and every one fails.
    Diagnosis
    A default client made 3 attempts per call, and an application loop multiplied them by 3.
    Fix
    Treat the spend-cap code or a missing retry-after as terminal, make zero retries, open the breaker, and escalate.
    Verify
    Run pnpm lab2:drill and confirm zero-retries reports upstream=1 and the breaker opens.
  • F-04pnpm lab2:drillReproducible

    A stream error after a 200

    Symptom
    The customer sees half a sentence as a finished reply.
    Diagnosis
    An error frame arrived before message_stop, and the SDK does not retry a mid-stream failure.
    Fix
    Buffer text and tool blocks until message_stop, discard the buffer on an error frame, and retry before any write.
    Verify
    Run pnpm lab2:drill and confirm no-early-exec passes for both stream incidents.
  • F-05pnpm lab2:drillReproducible

    Truncated tool arguments

    Symptom
    The reply says the refund was issued, but no refund is recorded.
    Diagnosis
    The turn ended with stop_reason max_tokens under HTTP 200, so the tool arguments were cut off.
    Fix
    Refuse to run tools on a max_tokens turn, escalate, and give the budget headroom beyond thinking.
    Verify
    Run pnpm lab2:drill and confirm the truncation incident makes zero tool attempts and escalates.
  • F-06pnpm lab2:drillReproducible

    A stale policy cache approves a refund

    Symptom
    A refund of 4800 cents goes out on an order delivered 38 days ago.
    Diagnosis
    The cached policy carried an older version with a 45 day window while the active version allows 30.
    Fix
    Compare the cached version with the active version before writes, invalidate the cache on a mismatch, and escalate.
    Verify
    Run pnpm lab2:drill and confirm no-wrongful-refund and cache-invalidated pass.
  • F-07pnpm lab2:drillReproducible

    A reply that disagrees with the desk

    Symptom
    The reply promises a refund while the refunded total is 0 cents.
    Diagnosis
    The write was rejected by the ledger, and nothing compared the reply with the system of record.
    Fix
    Reconcile the desk after the turn, withhold the reply on a mismatch, and send a safe escalation notice.
    Verify
    Run pnpm lab2:drill and confirm divergence-caught and no-false-claim pass.
  • F-08pnpm lab1:auditReproducible

    Raw personal data in an exported trace

    Symptom
    The exported file holds emails, phone numbers, and raw provider identifiers.
    Diagnosis
    Scrubbing ran after validation or after the write, so raw values reached disk.
    Fix
    Redact inside the export function before schema validation and before any write, and scan the written file.
    Verify
    Run pnpm lab1:audit and confirm raw leaks is 0 for every incident.

Transfer task and rubric

On an unseen workload, localize five incidents across four layers, redact a leaking export, set safe retry rules, and convert each incident into a regression that fails first.

Analytic rubric: each criterion described at four performance levels, from Emerging to Exemplary
Criterion0 · Emerging1 · Developing2 · Proficient3 · Exemplary
C1 Root-cause localizationLocalizes two or fewer incidents exactly.Localizes three incidents exactly.Names span, layer, and code exactly for four of five incidents.Names all five exactly and lists downstream secondary codes.
C2 Redaction at ingestPasses two or fewer redaction checks.Passes three of five redaction checks.Passes four of five, with no raw value left.Passes all five with an honest scan record.
C3 Retries and idempotencyPasses two or fewer policy checks.Passes three or four of six checks.Passes five of six checks.Passes all six, with a deterministic key and an unsafe proposal rejected.
C4 Stream and reconciliationPasses two or fewer guard checks.Passes three of five guard checks.Passes four of five guard checks.Passes all five, including truncation and the post-turn check.
C5 Regression conversionWrites two or fewer specs that fail on the broken build.Writes three useful specs.Writes four useful specs.Writes five specs that each fail first and then pass.
C6 Postmortem and runbookPasses two or fewer postmortem checks.Passes three of five checks.Passes four of five checks, with containment before repair.Passes all five, with systemic factors and owned follow-ups.

Proficiency standard: Proficient or higher on every criterion. Proposed local standard, not an official certification.

Self-check

The full brief

You receive synthetic incident traces for an unfamiliar service, an unredacted trace export, and a draft on-call proposal from a colleague. One tool changes state, and every incident returned HTTP 200 to the customer at some point.

Deliver three parts: a triage that names the earliest broken span, layer, and failure code for each incident, plus a redacted export; a bounded response policy that rejects the unsafe fields of the proposal; and a set of regression specs plus a blameless postmortem anchored to span ids.

The work is offline and costs $0.00. Passing needs at least 14 of 18 rubric points, Proficient or Exemplary on all six criteria, and none of the six automatic critical failures. Completion confirms mastery within this course only and is not an external certification.

Teach it to a room

  • Timed facilitation plan

    A 90-minute run of show with a hint ladder, a longer half-day option, and troubleshooting for rooms without API keys.

  • Cohort and enterprise rollout notes

    Pre-flight checks, a seven-day assessment window, and scoring of the unseen incident workload.

  • Dry-run observation rubric

    A classroom observation rubric paired with live diagnosis of seeded broken repairs.

  • Pending instructor clearance record

    A blank clearance record that stays pending until an authorized observer scores a live dry run.

  • Pass-rate report template

    Reports per-attending and per-assessed pass rates with intervals and suppresses small cells.

  1. [1]Claude API errors · platform.claude.comchecked Nov 30, 2026
  2. [2]Claude API rate limits · platform.claude.comchecked Nov 30, 2026
  3. [3]Handling stop reasons · platform.claude.comchecked Nov 30, 2026
  4. [4]Claude API and data retention · platform.claude.comchecked Nov 30, 2026
  5. [5]Claude pricing documentation · platform.claude.comchecked Nov 30, 2026
  6. [6]Demystifying evals for AI agents · anthropic.comchecked Nov 30, 2026
  7. [7]OpenTelemetry GenAI spans and agent spans · github.comchecked Nov 30, 2026
  8. [8]OpenTelemetry Semantic Conventions v1.42.0 release notes · github.comchecked Nov 30, 2026
  9. [9]Trace Context · w3.orgchecked Nov 30, 2026
  10. [10]Incident response · sre.googlechecked Nov 30, 2026
  11. [11]On-call · sre.googlechecked Nov 30, 2026
  12. [12]Postmortem culture: learning from failure · sre.googlechecked Nov 30, 2026
  13. [13]LLM02:2025 Sensitive Information Disclosure · genai.owasp.orgchecked Nov 30, 2026
  14. [14]@anthropic-ai/sdk 1.14.0 on npm · npmjs.comchecked Nov 30, 2026
  15. [15]zod 4.6.7 on npm · npmjs.comchecked Nov 30, 2026
  16. [16]Whys and hows of assessment: constructive alignment · cmu.educhecked Nov 30, 2026

Independent work. Not affiliated with or endorsed by any vendor named in this guide.

Jordan Hudgens

Written by

Jordan Hudgens

Technical educator and AI engineering leader. 16 Udemy courses, 111K students, and curricula used by 250K+ learners.

Contact Jordan

Next in the path

All guides