Skip to content

    Certification

    CCDV-P M3: Observability, Debugging and Incident Response

    Trace ids, token and stop-reason metrics, SLOs, segment alerts, golden-set isolation, canary comparison and the incident loop for Claude apps in production.

    By Published 40 min read

    Share

    This lesson is part of Claude Certified Developer — Professional. Enroll for free, then sign in, to read it in full.

    Modules 1 and 2 were about building agents and wiring them to the real world. This module is about knowing what they are doing once real traffic arrives, and about what you do when something goes wrong. The first half covers observability (what to record, what to alert on). The second half covers debugging and incident response (how to find the cause without guessing, and how to limit harm while you do it).

    Everything Anthropic-specific below, such as response fields, request ids and streaming events, comes from the official documentation listed under Where to verify. The rest is standard engineering practice for any distributed system, applied to a component that is probabilistic and whose "success" is not an HTTP status.


    3.1 One trace id across the whole request

    A single user request in a Claude application usually touches many components: an auth check, a retrieval query, one or more model calls, several tool calls, and a post-processing step. When the answer is wrong, you need to see all of those as one story.

    Principle. Generate one trace id at the edge (or accept one from the caller), and pass it through every component. Every log line, span and metric exemplar carries it. Model calls and tool calls are child spans of the request span.

    Mechanism. Two kinds of identifier matter and they are not the same thing:

    Identifier Who creates it What it is for
    Your trace id Your application Joining auth, retrieval, model calls, tools and the user-visible outcome
    The API request id Anthropic's API Asking Anthropic support about one specific API call

    Every Claude API response carries a request-id header, and the same value appears as request_id in error response bodies. In the Python and TypeScript SDKs the id of a successful call is exposed as a _request_id property on the response object. Store it next to your trace id so that a trace can be joined to a support ticket. It does not replace your own id, because it only exists for calls that reached the API.

    Figure 1. One trace id travels to every hop

    One trace id travels to every hopCaller to Edge (request); Edge to Auth check; Edge to Retrieval; Edge to Model call; Edge to Tool call; Auth check to Trace store; Retrieval to Trace store; Model call to Trace store (spans); Tool call to Trace storeCallerCallerEdge: creates trace idEdgecreates trace idAuth checkAuth checkRetrievalRetrievalModel call: keeps request idModel callkeeps request idTool callTool callTrace store: one joined storyTrace storeone joined storyrequestspans

    How to read this: the edge creates the id once and every hop gets it. The dashed arrows are spans flowing into one store, so a single search returns the whole request.

    TIP

    Picture it: Think of the paper tag an airline clips to your suitcase. The same tag number is scanned at check-in, on the sorting belt, at the plane and at the carousel, so one lookup shows the whole journey. The API request id is more like the airline's number for a single flight leg: useful to its helpdesk, but it only exists once the bag is on that leg. Where it stops matching: nobody scans your trace id for you, your own code has to pass it along at every hop.

    NOTE

    If a request is retried, each attempt is a separate API call with its own request id. Record every attempt as its own child span under the same trace, with an attempt number.

    Exam angle. A scenario says users report wrong answers "sometimes" and the team only has per-service logs with no shared id. The best answer introduces a propagated trace id and structured spans across retrieval, model and tool steps. Common trap: adding more verbose logging inside the model-calling service only. More logs in one place cannot show you which document retrieval handed to the model or which tool call changed the state.


    3.2 What to record on every model call

    A model call span should carry a small, fixed set of dimensions. They let you slice every later question: which prompt version, which model, which outcome.

    Dimension Source Why it matters
    Model identifier Request and response model Model swaps are releases; compare before and after
    Prompt version Your own registry Rollback and "did the prompt change?" answers
    stop_reason Response Truncation, tool calls, refusals and normal ends look different
    Token usage Response usage Cost, latency and context-size trends
    Latency (and time to first token if streaming) Your clock User experience and capacity
    Feature, team or tenant Your own metadata Cost attribution and segment analysis

    The documented stop_reason values include end_turn, max_tokens, stop_sequence, tool_use, pause_turn, refusal and model_context_window_exceeded. A refusal is returned as a normal HTTP 200 response rather than an error, so an HTTP-level dashboard will count it as a success. Only a metric keyed on stop_reason will show it.

    Token usage needs care. With prompt caching, input_tokens is only the input that was neither read from nor written to a cache. The documented total is cache_read_input_tokens + cache_creation_input_tokens + input_tokens. If you chart input_tokens alone, a healthy cache looks like a cost collapse and a broken cache looks like normal.

    import time
    import anthropic
    
    client = anthropic.Anthropic()
    
    def traced_call(trace_id: str, prompt_version: str, feature: str, **params):
        started = time.monotonic()
        message = client.messages.create(**params)
        log_event({  # log_event is your own structured logger
            "trace_id": trace_id,
            "request_id": message._request_id,
            "feature": feature,
            "prompt_version": prompt_version,
            "model": message.model,
            "stop_reason": message.stop_reason,
            "input_tokens": message.usage.input_tokens,
            "cache_read_tokens": message.usage.cache_read_input_tokens,
            "cache_write_tokens": message.usage.cache_creation_input_tokens,
            "output_tokens": message.usage.output_tokens,
            "latency_ms": round((time.monotonic() - started) * 1000),
        })
        return message

    Cost attribution. Your own per-call logs give per-feature and per-team cost, because you know the feature that made each call. For the organisation-wide view that finance reconciles against, Anthropic provides Admin API usage and cost reports (usage can be grouped by model, workspace and service tier, among others). These need an Admin API credential, the usage data typically arrives about 30 minutes after the request, and the docs mark that API as the legacy one with a newer analytics API recommended for new work. Use provider reports to reconcile, and your own tagged logs to attribute.

    Exam angle. A scenario shows a flat HTTP 200 rate while a downstream team complains about missing answers. The answer adds stop_reason and an outcome label to the metrics. Common trap: "add an alert on 5xx errors". The failing responses are successful HTTP responses.


    3.3 Infrastructure metrics versus quality metrics

    Two different questions need two different families of metric.

    Family Examples Question it answers
    Infrastructure Request rate, error rate by status, latency percentiles, retry count, token throughput Is the plumbing healthy?
    Behaviour and quality Task success rate, refusal rate, truncation rate (max_tokens), groundedness score from a sampled judge, escalation-to-human rate, user thumbs-down Is the system doing the job?

    Figure 2. A healthy API can still give bad answers

    Infrastructure metrics and quality metrics answer different questionsClaude call to Infra metrics (every call); Claude call to Quality proxies (every call); Claude call to Sampled judge (a sample); Infra metrics to Plumbing healthy?; Quality proxies to Job being done? (fast); Sampled judge to Job being done? (lags)Claude call: returns HTTP 200Claude callreturns HTTP 200Infra metrics: errors, latencyInfra metricserrors, latencyQuality proxies: refusal, schemaQualityproxiesrefusal, schemaSampled judge: rubric scoreSampled judgerubric scorePlumbing healthy?Plumbinghealthy?Job being done?Job beingdone?every callevery calla samplefastlags

    How to read this: the top path can be green while the bottom path is red. The quality proxies are fast, the judge is slower but deeper.

    HTTP success is not task success. A call that returns 200 with a hallucinated policy answer, a refusal or a response cut off by max_tokens is a success to the load balancer and a failure to the user. Define a task-level outcome for every feature (for example, "the refund was created and the customer confirmed") and emit it as a metric.

    TIP

    Picture it: A restaurant kitchen has a dashboard showing every oven at the right temperature, every order leaving on time and no equipment faults. Meanwhile diners are sending plates back because the dish is cold or wrong. Equipment readings and diner reactions answer two different questions, and you need both. Where it stops matching: a bad model answer arrives looking like a successful order, so you have to go looking for it.

    Quality metrics are usually computed on a sample, offline or by a calibrated judge (module 5), so they lag. Pair them with fast proxies you can compute on every request: refusal rate, truncation rate, schema-validation failure rate, tool-error rate.

    NOTE

    Monday, support desk: Priya looks after the support tooling at Larkspur Insurance. Her dashboard is green: every call in the last hour returned HTTP 200 and latency is normal. Yet agents keep telling her that customers received no answer. She adds stop_reason to the metrics and finds that 120 of the last 1,000 calls ended with refusal, which is 12%. A prompt edit the day before had removed the sentence explaining that the assistant handles policy questions. The plumbing was fine; the feature was not. Invented example.

    Exam angle. "Dashboards are green but the support team reports a spike in bad answers." The answer is to add behaviour metrics and sampled quality scoring next to the infrastructure ones. Common trap: scaling out or raising rate limits. Capacity is not the problem if the calls succeed.


    3.4 Latency: time to first token versus total time

    There are two numbers and they have different causes.

    • Time to first token (TTFT): how long until the user sees anything. It is dominated by queueing, network, and processing the input prompt, so it grows with prompt size.
    • Total completion time: TTFT plus generation. Generation time grows with the number of output tokens.

    Streaming does not make the model finish sooner. It lets you show tokens as they arrive, so it improves perceived latency, not total time. To measure TTFT you must stream, and take the timestamp of the first content event.

    TIP

    Picture it: At a coffee shop, time to first token is how long until the barista looks up and starts your drink. Total time is how long until the cup is in your hand. Streaming is like watching the drink being made through the counter window: you see progress straight away, but the cup still lands in your hand at the same moment. Where it stops matching: streamed tokens are the real answer arriving in pieces, not a progress bar.

    The documented event flow is message_start, then for each content block a content_block_start, any number of content_block_delta events and a content_block_stop, then one or more message_delta events and a final message_stop. ping events can appear anywhere. The usage counts in message_delta are cumulative. Errors can also arrive as an error event after the HTTP response has already started with status 200, for example an overloaded_error. With the SDK, the stream ends and your reading code gets an exception instead.

    import time
    
    def stream_with_ttft(**params):
        started = time.monotonic()
        first_token_ms = None
        with client.messages.stream(**params) as stream:
            for _text in stream.text_stream:
                if first_token_ms is None:
                    first_token_ms = round((time.monotonic() - started) * 1000)
            final = stream.get_final_message()
        total_ms = round((time.monotonic() - started) * 1000)
        return final, first_token_ms, total_ms
    NOTE

    A stream that dies mid-way may have already shown partial text to the user. Treat a dropped or errored stream as a failed request in your metrics even though the HTTP status you saw was 200.

    Worked example (illustrative numbers). An answer feature has TTFT 0.8 s. It generates 600 output tokens at 50 tokens per second, which is 12 s. Total is about 12.8 s. Halving the prompt might cut TTFT a little, but the large cost is generation. Asking for a shorter answer, or splitting the work, is what moves the total. If the complaint is "it feels frozen", streaming fixes perceived latency without changing the 12.8 s.

    Figure 3. Where TTFT and total time are measured (illustrative numbers)

    sequenceDiagram accTitle: Where time to first token and total time are measured in a stream accDescr: A request goes from the app to the Claude API. Time to first token ends when the first text arrives. Total time ends at message stop. The numbers are illustrative. participant U as Your app participant A as Claude API U->>A: Send request with the prompt Note over U,A: Queueing, network and input processing A-->>U: message_start A-->>U: content_block_start A-->>U: first content_block_delta with text Note over U: TTFT clock stops here, illustrative 0.8 s A-->>U: more content_block_delta events Note over U,A: Generation time grows with output tokens, illustrative 12 s A-->>U: message_delta and message_stop Note over U: Total time, illustrative 12.8 s

    How to read this: the first note is the wait before anything appears, the second is the long middle. Streaming only changes when the reader starts seeing text, not when the last event arrives.

    Exam angle. A scenario reports a "slow" feature and gives TTFT and generation figures. Read which part dominates before choosing. Common trap: switching on streaming to fix a total-time SLO. Streaming helps a perceived-latency target only.


    3.5 SLOs, alert windows and segments

    An SLO is a target for a user-facing indicator over a window. For Claude applications you need three kinds: latency (for example, 95th percentile TTFT), quality (task success or groundedness on the sampled set) and cost (spend per completed task).

    Error budgets. A 99.5% success SLO over 30 days allows 0.5% failure. A 30-day month has 43,200 minutes, so the budget is 0.5% of that, or 216 minutes of full outage, or the equivalent in failed requests.

    Burn-rate alerts with two windows. Alert on how fast the budget is being spent, using a short and a long window together. The short window (for example 5 minutes) makes the alert fast and lets it clear quickly. The long window (for example 1 hour) stops a brief blip from paging anyone. Page only when both are over threshold.

    # Illustrative rule; thresholds are examples, tune them to your own SLO.
    alert: ChatTaskSuccessBurn
    when:
      - task_failure_ratio[5m]  > 14 * error_budget_ratio
      - task_failure_ratio[1h]  > 14 * error_budget_ratio
    severity: page

    Segment your metrics. An aggregate can sit comfortably inside the SLO while one segment is far outside it.

    Worked example. Of 1,000,000 requests, 50,000 come from enterprise tenants. Enterprise tasks fail 20% of the time, which is 10,000 failures. The other 950,000 requests fail 1% of the time, which is 9,500. Total failures are 19,500, or 1.95% overall. The SLO says 2%, so the aggregate dashboard stays green while a customer tier sees one task in five fail. Slice by tier, tenant size, language, feature and model, and put SLOs on the segments that have contractual weight.

    TIP

    Picture it: A hotel reports that the average room temperature across the building is comfortable. One floor, the conference rooms, is freezing. The average is true and no use at all to the people on that floor. A separate thermostat and alarm per floor is what a segment SLO gives you. Where it stops matching: you choose the segments yourself, so pick the ones that carry contracts or risk.

    Zero-tolerance signals. Some events should not be averaged at all. A failed tool call that enforces a safety property (an approval check, an authorisation lookup, a redaction step) should alert on a single occurrence. Record per-tool status (success, failure, timeout) as a metric, and give safety-critical tools a "any failure pages" rule rather than a ratio.

    Exam angle. A scenario reports "overall quality is fine at 97%" while a customer segment complains. The answer is segment-level measurement and alerting. Common trap: lowering the aggregate threshold. That makes the alert noisier everywhere and still lets a small segment hide in the average.


    3.6 Tool status, audit logs and privacy

    Structured audit logs. For any action with consequences (refunds, data access, record changes), log who, what record, why and when, as structured fields, and log the outcome. "Why" means the stated reason or ticket and the trace id, not the model's chain of thought.

    {
      "ts": "2026-12-03T09:14:22Z",
      "trace_id": "tr_8c1f",
      "actor": {"user_id": "u_4412", "on_behalf_of_agent": "support-agent-v7"},
      "action": "refund.create",
      "record": {"type": "order", "id": "ord_9931"},
      "reason": "ticket T-5520: duplicate charge",
      "approval": "human:u_208",
      "result": "ok"
    }

    Notice what is missing: the customer's card number, address and the full message text. Log identifiers that let an authorised person look the record up, not copies of sensitive values.

    Privacy and retention. Prompts and responses can contain personal data. Decide what content you capture, why, who can read it, and when it is deleted. Capture content only where you need it (for example, for a sampled quality review), redact known patterns before storage, set a retention limit, and keep metrics (counts, token numbers, stop reasons) separate from content so metrics can live longer.

    The same rule applies to any telemetry export built into developer tooling: check the vendor's monitoring documentation for which events are emitted and whether prompt text is included, and keep content logging off unless you have a reason and a retention policy for it.

    Exam angle. A scenario asks for "a full record of every agent action for compliance" and mentions customer PII. The answer is structured audit records with identifiers and outcomes, access-controlled and retention-limited. Common trap: dumping complete prompts and responses into the general log index. That creates a second, unprotected copy of the sensitive data.


    3.7 Classify the failure first

    When something is wrong, the first step is to decide what kind of failure it is, because each kind has a different owner and a different fix.

    Class Typical symptoms First place to look
    Infrastructure Timeouts, 429s and 5xx, rising latency API error rates and request_ids, retries, connection pools
    Quality Plausible but wrong or ungrounded answers, format drift Retrieved context, prompt version, golden-set score
    Safety Disallowed content, leaked data, unauthorised action Audit log, guardrail hits, tool permissions
    Tool Wrong or missing side effects, repeated tool errors Per-tool status, tool input and output in the trace
    Agent Loops, wrong step order, abandoned tasks Turn count, tool-call sequence, termination reason

    Follow the trace evidence: open the trace for a failing request and compare it with a healthy one. Look at what the model actually received (retrieved text, tool results, prompt version) before theorising about the model.

    Figure 4. Classify the failure from the evidence

    flowchart TD accTitle: Classifying a failure from the trace evidence accDescr: Start from the failing trace compared with a healthy one, then ask in turn about infrastructure errors, safety, tool problems and agent loops. If none apply the failure is a quality failure. S["Failure reported"] --> T["Open the failing trace and compare it with a healthy one"] T --> Q1{"Errors, timeouts or 429s?"} Q1 -- yes --> I["Infrastructure: API errors, retries, pools"] Q1 -- no --> Q2{"Disallowed content or an unauthorised action?"} Q2 -- yes --> SA["Safety: audit log, guardrails, tool permissions"] Q2 -- no --> Q3{"Wrong side effect or repeated tool errors?"} Q3 -- yes --> TO["Tool: per-tool status, tool input and output"] Q3 -- no --> Q4{"Loops or wrong step order?"} Q4 -- yes --> AG["Agent: turn count, tool sequence, termination reason"] Q4 -- no --> QU["Quality: retrieved context, prompt version, golden-set score"]

    How to read this: follow the arrows from the top and stop at the first yes. Each box on the right names the first place to look and the owner of the fix.

    Exam angle. A scenario gives a symptom and several "fixes" that each belong to a different class. The right answer is the one that matches the evidence. Common trap: changing the model or temperature before reading a single trace.


    3.8 Isolate variables with a frozen golden set

    When quality drops after a release that changed several things (prompt, model, retrieval settings), you cannot tell which change did it by arguing. Change one variable at a time against a frozen golden set: a fixed collection of inputs with expected outcomes (or graded by a fixed rubric) that never changes during the investigation.

    Run Prompt Model Reading
    A (baseline) old old Confirms the golden set still passes on the old system
    B new old Isolates the prompt change
    C old new Isolates the model change
    D new new Confirms the combined behaviour you shipped

    Figure 5. One frozen set, four runs, one variable at a time

    flowchart TD accTitle: A frozen golden set run four ways to isolate one variable accDescr: The same frozen golden set is run with old prompt and old model, new prompt only, new model only, and both new. Each result points to a different reading. G["Frozen golden set, never edited during the investigation"] --> A["Run A: old prompt, old model"] G --> B["Run B: new prompt, old model"] G --> C["Run C: old prompt, new model"] G --> D["Run D: new prompt, new model"] A --> VA["Baseline passes, so the set is sound"] B --> VB["B regresses and C does not: the prompt"] C --> VC["C regresses and B does not: the model"] D --> VD["Only D regresses: the two interact"]

    How to read this: all four runs start from the same box at the top. Compare any two runs that differ in one thing, and the verdict at the bottom follows.

    If B regresses and C does not, the prompt is at fault. If neither regresses alone but D does, the two interact, and that is its own finding. The whole point is that only one thing differs between any two runs.

    TIP

    Picture it: A teacher changes both the textbook and the teaching method, and exam scores fall. To find out which one hurt, she gives the same exam paper to four classes, each using a different mix of old and new. The paper must not change halfway, because rewritten questions make the scores impossible to compare. That fixed paper is your golden set.

    WARNING

    Never edit the golden set mid-investigation to "make it fair". A set that moves cannot isolate anything. Add new cases to a separate set and merge them afterwards.

    Exam angle. "Quality dropped after we updated the prompt and moved to a newer model in the same release." The answer is the two-run isolation above. Common trap: rolling back everything at once. That may restore service but teaches you nothing about which change is safe to retry.


    3.9 Same input, different outputs; sudden change, nothing changed

    Identical inputs giving different outputs. Temperature is the usual suspect, but check retrieval first. If the same question retrieves different chunks on different runs (an approximate index, ties in ranking, a changing corpus, a non-deterministic filter), the model is answering from different evidence and will give different answers even at a fixed sampling setting. Log the retrieved chunk ids with the trace and compare them across the differing runs. Only when the retrieved context is identical should you turn to sampling settings.

    Sudden change with unchanged prompts. If nobody deployed a prompt or model change, look upstream and around:

    • the data that feeds retrieval (a re-index, a bad import, a schema change in a source system);
    • tool behaviour (a downstream API changed its response format or started returning errors);
    • context assembly (a template variable now empty, a feature flag flipped);
    • traffic mix (a new customer or a new language changed the input distribution).

    A useful question is "what changed in the last hours that is not in the prompt repository?" The answer is often a configuration or data change that was never versioned alongside the prompt.

    Exam angle. "Answers got worse on Tuesday and no one touched the prompt." The answer inspects upstream data, tool outputs and context assembly using the trace. Common trap: blaming the model provider without comparing the inputs the model received on Monday and Tuesday.


    3.10 Canary comparison and config propagation

    When a change reaches production gradually, a canary (a small slice of traffic on the new version) is compared with the baseline (the rest, on the old version) on the same metrics at the same time. Because both run concurrently, time-of-day and traffic effects cancel out.

    If the canary shows an anomaly confined to one region, tenant group or channel, halt only the anomalous slice and keep the rest of the rollout going, while you investigate. Halting everything slows safe progress and hides the fact that the problem is local, which is itself a clue. Rolling forward everywhere with "it is only 2%" spreads the harm.

    Figure 6. Canary against baseline, halting only the odd slice

    Canary against baseline with one region haltedTraffic split to Baseline; Traffic split to Region A canary; Traffic split to Region B canary; Baseline to Comparison; Region A canary to Comparison; Region B canary to Comparison; Comparison to Keep rolling (no anomaly); Comparison to Halt region B (anomaly)Traffic split: same time windowTraffic splitsame time windowBaseline: old versionBaselineold versionRegion A canary: new versionRegion Acanarynew versionRegion B canary: new versionRegion Bcanarynew versionComparison: canary, baselineComparisoncanary, baselineKeep rolling: region AKeep rollingregion AHalt region B: only that sliceHalt region Bonly that sliceno anomalyanomaly

    How to read this: baseline and canaries run side by side, so time of day affects both equally. The red path stops only the region that looks wrong while the rest continues.

    Config propagation delays. Configuration (a new prompt version, a feature flag, a routing rule) usually passes through several caches: a config service, an application cache, a CDN or edge layer. Each has its own time to live. Fixing the source does not fix production until every layer has expired, so a rollback can appear to "not work" for several minutes. Align the TTLs, or provide a purge or version-bump path, and know the longest delay in your chain before you promise a recovery time.

    Versioned prompts and fast rollback. Treat prompts like code: versioned, identified in every trace, and deployable and revertible independently of the application binary. A rollback that needs a full redeploy is slow and risky.

    Exam angle. "Latency is up in one region only on the new version." The answer compares canary and baseline and halts that region, not the global rollout. Common trap: declaring the fix failed because users still see the old behaviour right after rollback, instead of checking cache TTLs.


    3.11 The incident loop: mitigate first

    A workable loop for incidents in AI systems is assess, mitigate, diagnose, resolve, postmortem.

    1. Assess. Who is affected, how badly, and is harm still happening?
    2. Mitigate. Stop the harm before you understand it. Roll back the prompt, disable the feature or tool, switch to a degraded mode, route to humans, or block the affected segment.
    3. Diagnose. Use traces, the golden set and canary comparison to find the cause.
    4. Resolve. Apply and verify the real fix.
    5. Postmortem. Learn from it (3.12).

    Figure 7. The incident loop: contain before you understand

    flowchart LR accTitle: The incident loop with mitigation before diagnosis accDescr: Assess who is affected, then mitigate. If harm is not yet contained, try the next safe containment. Once contained, diagnose, resolve and hold a postmortem. A["Assess: who is affected, is harm still happening?"] --> M["Mitigate: kill switch, rollback, route to humans"] M --> C{"Harm contained?"} C -- no --> M C -- yes --> D["Diagnose: traces, golden set, canary comparison"] D --> R["Resolve: apply and verify the real fix"] R --> P["Postmortem: timeline, factors, owned follow-ups"]

    How to read this: the loop on Mitigate is the point. You keep containing until harm stops, and only then move right to diagnosis.

    Mitigate first when harm is active. If an agent is sending wrong refunds or exposing data, the correct first move is the quickest safe containment (a kill switch, a feature flag, removing the tool), not a root-cause investigation while customers continue to be affected. Mitigation does not need a diagnosis, which is the point.

    TIP

    Picture it: A pipe bursts in a kitchen. You do not start by working out who installed it badly. You turn off the water at the main valve first, then investigate with a dry floor. Kill switches are that valve, and they only help if they were installed and labelled before the pipe burst. A good one can often be per tool, so you shut off only the leaking part.

    NOTE

    Build the kill switches before you need them: a per-tool disable flag, a global "route to human" switch, and a way to pin the previous prompt version. During an incident is the wrong time to design them.

    NOTE

    On call, 3 a.m.: Tomasz is on call for Bramblewood Credit Union. At 3:04 an alert shows the support agent issuing refunds that match no ticket. His instinct is to start reading traces, but the runbook says to contain first, so he flips the per-tool disable flag on the refund tool. By 3:07 the agent can still chat but cannot move money, and refund requests go to a human queue. Only then does he open the traces, and he finds the cause in the evening's prompt release. The team ships a fix at midday. Invented example.

    Exam angle. A scenario describes ongoing harm and offers "find the root cause" versus "disable the tool now". Disable first, investigate second. Common trap: the investigation-first option sounds rigorous, but each minute of delay is more affected users.


    3.12 Shadow logging, postmortems and recovery pitfalls

    Shadow logging for non-reproducible issues. Some failures only appear with production conditions: real data shapes, real concurrency, a specific tenant's documents. When you cannot reproduce one, capture more at the moment it happens. A shadow path records the full inputs, retrieved context and intermediate results for a small or targeted slice (for example, only the affected tenant), under your privacy and retention rules, without changing what the user sees. You can then replay the captured cases offline against candidate fixes.

    Blameless postmortem. The goal is to understand how the system allowed the failure, not who made a mistake. A good postmortem has a timeline, the impact, the contributing factors (technical and process), what detected it and how fast, what worked and what did not, and concrete follow-ups with owners. The most valuable follow-up in AI systems is to turn the failure into a regression eval: add the failing inputs to the golden set so the same failure fails a release gate next time.

    Recovery can cause a second incident. When service comes back, a flood of retried requests and autoscaled workers arrives at once. If every new worker opens its own connections to a shared resource such as a database or vector store, the connection pool can be exhausted and the incident extends. Cap per-instance pools and total concurrency, ramp traffic back gradually, use jittered backoff for retries (module 2), and watch shared-resource saturation as a metric, not only the application's own error rate.

    Exam angle. A scenario says the outage is over, autoscaling added many workers, and now the database is rejecting connections. The answer limits concurrency and pool size and restores traffic gradually. Common trap: adding more workers to "absorb the backlog". That multiplies the demand on the exhausted shared resource.


    3.13 Spans for agent loops and tool calls

    Domain 3 topic: shaping the trace so an agent run can be read like a call stack. Section 3.1 says model and tool calls are child spans of the request. An agent loop needs a little more structure, because one request can contain many turns, parallel tool calls and delegated subagents.

    request            trace_id, tenant, feature, prompt_version
      retrieval        query, top_k, returned chunk ids
      agent_loop       turns_used, turn_limit, termination_reason
        turn 1
          model_call   attempt, model, stop_reason, usage, latency_ms
          tool_call    tool, status, duration_ms, input_size, output_size
        turn 2
          model_call
          tool_call    tool, status, approval, idempotency_key
        turn 3
          model_call   stop_reason = end_turn
      postprocess      schema_valid
    Span Why it exists
    agent_loop Holds the totals (turns, tokens, cost) and the reason the loop stopped: normal end, turn limit, budget, error
    turn Keeps ordering readable, so "turn 4 repeated turn 3" is visible at a glance
    model_call One per attempt, so retries are separate spans (3.1)
    tool_call Linked to the model call that requested it, using the tool use id the model returned

    Three details are easy to miss. First, tool calls the model requested in the same turn can run in parallel, so they appear as overlapping sibling spans; the slowest one sets the turn's critical path. Second, when the orchestrator delegates to a subagent, pass the trace context in the handoff so the subagent's whole run becomes a child span of the delegating call. Without that, each subagent starts a new trace and the story breaks at exactly the boundary you most need to see. Third, record sizes and status for tool inputs and outputs by default, and keep the content itself for the privacy rules in 3.16.

    What the shape tells you: a very deep tree is a loop, a wide tree is fan-out, and one long span on the critical path is where latency lives. Alert on turns_used approaching turn_limit, not just on failures.

    NOTE

    Exam angle. A scenario says some requests take 40 seconds and nobody knows why. The best answer is a span hierarchy that shows which turn or tool call dominates. Common trap: reporting only one total latency per request. It cannot separate a slow tool from a loop of many fast turns.


    3.14 Cache performance and token cost telemetry

    Domain 3 topic: knowing whether prompt caching is working, and what a task really costs. Section 3.2 gave the three input fields. Now turn them into two numbers.

    Cache hit ratio = cache_read_input_tokens / (cache_read_input_tokens + cache_creation_input_tokens + input_tokens).

    Invented example: a healthy request reads 9,000, writes 0 and has 1,000 uncached tokens, so the ratio is 9,000 / 10,000 = 90%. After a deploy it reads 0, writes 9,000 and has 1,000 uncached, so the ratio is 0%. Latency and cost both rise, and nothing errors. Chart the ratio per prompt version and alert on a drop against your own baseline, because a good value depends on your traffic.

    NOTE

    Tuesday, after the deploy: Imani works on the shopping assistant at Tidewater Outfitters. She ships a small prompt tweak that puts the current time on the first line of the system prompt. No errors, no alert. Two days later finance asks why spend is up. She charts the cache hit ratio per prompt version and sees 90% before the tweak and 0% after: every request now writes the cache and reads nothing, because the time changes the start of the prefix each time. She moves the time below the cached part and the ratio recovers. Invented example.

    Caching matches exact prefixes, so a collapse almost always means the prefix changed or the entry expired:

    • Something variable (a timestamp, user name, request id) now sits near the start of the prompt, before the cached part.
    • Tool definitions or the system prompt were edited or reordered, which changes everything after them.
    • Traffic is too sparse, so entries expire between requests. Check the documentation for current cache lifetimes.
    • The prompt fell below the minimum cacheable length. Check the documentation for the current minimum per model.

    Cost per task, not per request. An agent task of six turns makes six model calls, and each call re-sends the growing context. Per-request averages hide this. Compute cost per completed task as the sum over calls of each token category times its price. Cache reads are priced lower than ordinary input and cache writes higher; read the current pricing page for the multipliers rather than hard-coding them.

    A useful dashboard shows tokens by category, hit ratio, and cost per task at p50 and p95, split by feature and tenant tier. The p95 matters: a handful of runaway loops can dominate spend while the median looks fine.

    NOTE

    Exam angle. Costs rose 30% after a prompt tweak and error rates are flat. The answer checks cache read versus creation tokens per prompt version. Common trap: assuming traffic grew, or switching to a smaller model, before looking at the cache fields.


    3.15 Grounding and reasoning traceability

    Domain 3 topic: being able to answer "what did the model have in front of it, and what did it do with it?" for any single response.

    For a retrieval-grounded answer, record these in the trace:

    • the chunk ids returned by retrieval, with the source document's revision and the rank or score;
    • which of those chunks actually made it into the prompt after any truncation or reranking;
    • the citations in the answer, mapped back to chunk ids;
    • tool results by identifier, for answers that rest on a lookup.

    With that, a wrong answer sorts into one of three cases: the right evidence was never in the context, it was there and the model ignored or contradicted it, or the model cited something that was never in the context at all. The third case can be checked automatically on every response.

    def ungrounded_citations(cited_ids: set[str], context_ids: set[str]) -> set[str]:
        """Citations the model produced that were never in its context."""
        return cited_ids - context_ids

    Emit the share of responses with a non-empty result as a metric. It is cheap, runs on all traffic, and catches fabricated references before a sampled judge would.

    Reasoning traceability. Do not treat a model's written explanation of why it did something as a reliable record of its true cause. It is generated text, it can be wrong, and under 3.6 it is not an acceptable "reason" for an audit record. If you capture any reasoning output the platform returns, treat it as additional evidence and as sensitive content under your retention rules. The dependable record is observable: the inputs, the tool calls, the tool results and the final output, joined by the trace id.

    NOTE

    Exam angle. Reviewers cannot tell why an answer cited a policy that does not exist. The best answer logs retrieved chunk ids and verifies citations against the context. Common trap: asking the model to "explain its reasoning" and storing that as the audit trail.


    3.16 Structured events and content capture under zero data retention

    Domain 3 topic: logging enough to debug without creating a privacy problem.

    Structured events. Emit one JSON event per notable step with a fixed, versioned schema: event name, timestamp, trace id, span id, severity and the dimensions from 3.2. Keep high-cardinality values such as trace ids in logs and traces, not as metric labels. Structured fields let you query "all tool_call events with status = timeout for prompt v21" instead of searching free text.

    Zero data retention. A zero-data-retention (ZDR) arrangement concerns what the provider stores of your prompts and responses. Check the current documentation and your own agreement for exactly what is covered and which features are eligible. It says nothing about your own systems. If you copy every prompt and response into a log index, you have recreated the retention the arrangement was meant to avoid.

    Handling Examples
    Log by default Trace and request ids, model, prompt version, stop_reason, token counts, latency, tool name and status, retrieved chunk ids, outcome label
    Capture only by opt-in Prompt and response text, tool inputs and outputs: per feature or tenant, time-boxed, redacted first, stored separately with access control and a short retention period
    Do not log Secrets, credentials, raw identifiers such as card numbers

    Remember the third parties. If an observability library or vendor agent instruments your SDK calls automatically, check what it captures by default and where it sends it, and turn content capture off until you decide otherwise. Provide a way to honour deletion requests for any content you do keep.

    The design goal is that metadata alone answers most questions (which version, which tool, which stop reason, which chunk ids), so content capture can stay rare.

    NOTE

    Exam angle. A regulated customer is on ZDR and engineers want full transcripts for debugging. The answer is metadata by default plus narrow, redacted, opt-in capture. Common trap: "the provider keeps nothing, so our logs can keep everything".


    3.17 A quality SLI from sampled, judged traffic

    Domain 3 topic: putting a quality target on the same footing as latency and availability. Section 3.5 listed quality as one of three SLO kinds. The difficulty is that quality cannot be measured on every request.

    Method. Sample production traffic, score each sampled response with a judge against a written rubric (for example, "every claim is supported by the retrieved context"), and define the SLI as the fraction judged good. The judge must be calibrated against human labels and re-checked, and it can drift when the judge's own model changes (module 5), so log the judge version with each score.

    # Illustrative definition; numbers are invented.
    sli: grounded_answer_ratio
    good: sampled responses the judge marks grounded
    total: sampled responses scored
    sampling: 400 per day, stratified by feature and tenant tier
    objective: 95% over 28 days
    alert: burn rate over a 1-day and a 7-day window

    Sample size sets the resolution. With a true rate near 95%, a day of 400 samples carries a margin of about plus or minus 2 percentage points (1.96 x the square root of 0.95 x 0.05 / 400, roughly 0.021, by the normal approximation). A one-point regression is invisible in one day's data. Over 28 days that is 11,200 samples and the margin is about 0.4 points. This is why a quality SLO uses longer windows than a latency SLO, and why it pairs with fast per-request proxies such as refusal, truncation and ungrounded-citation rates.

    Stratify. A uniform sample over-represents big segments. Sample per feature and tenant tier so the small, contractually important segments get enough scored responses to alert on (3.5).

    Error budget. A 95% objective leaves a 5% budget of judged-bad responses. Spend it deliberately: when it is burning fast, slow risky releases.

    NOTE

    Exam angle. "Define a quality SLO for a support assistant." The answer uses a calibrated judge on sampled live traffic, stratified, over a window sized to the sample. Common trap: using a weekly golden-set run as the SLI. That is a release gate on fixed inputs, not a measure of what users receive.


    3.18 Drift after model updates and anomalous usage

    Domain 3 topic: catching slow changes in behaviour and sudden changes in consumption.

    Drift after a model update. Behaviour can change without any change in your code, for example when a moving model alias starts pointing at a newer model, or when you migrate on purpose. Where the platform offers both a pinned model identifier and a moving alias, check the current model documentation, and prefer a pinned identifier in production so that a model change is a release you schedule and test. Record the response model field on every call and alert if it differs from what you expect. Also track published deprecation dates for the models you use.

    Because a model change moves many things at once, watch a behavioural fingerprint, not one score:

    • the stop_reason mix, including refusal and max_tokens shares;
    • output length distribution;
    • tool calls per task and turns per task;
    • schema-validation failure rate;
    • the quality SLI from 3.17, and the judge score distribution.

    Before cutover, run the frozen golden set (3.8) and a shadow or canary slice on the new model, and compare fingerprints with the baseline running at the same time (3.10).

    Anomalous usage. Alert on consumption against each tenant's, key's and feature's own baseline, not a global one. Invented example: a tenant's trailing seven-day median is 2 million tokens per hour and the alert is set at five times that, 10 million. An hour at 38 million fires it. Likely causes: a loop (turns per task climbing), a retry storm, a leaked credential, or a prompt-injected agent being driven to burn calls.

    Pair detection with containment: a per-task turn and token cap, per-tenant budgets that throttle or stop, and a key rotation path.

    NOTE

    Exam angle. Quality fell on Monday and the team deployed nothing. Check whether the model identifier in responses changed. Common trap: relying on an alias in production and discovering a model change only through user complaints.


    3.19 Sampling and failure-cohort analysis

    Domain 3 topic: working at a scale where you cannot keep every trace.

    Sampling strategies.

    Strategy Decides Problem or strength
    Head-based, random At the start of the request Cheap and unbiased, but the failure is not yet known, so most failing traces are dropped
    Tail-based After the trace completes Can keep every failure, refusal, timeout and slow trace, plus a small random share of healthy ones as a baseline
    Targeted By rule Full capture for a new prompt version, a canary or one tenant

    Figure 8. Count everything, store a sample

    Always-on counters beside a tail-based trace samplerApplication to Always-on counters (count); Application to Tail sampler (finished traces); Always-on counters to True failure rates; Tail sampler to Trace store (keep); Trace store to Cohort analysis (explain failures)Application: every requestApplicationevery requestAlways-on counters: every requestAlways-oncountersevery requestTail sampler: decides after finishTail samplerdecides afterfinishTrue failure ratesTrue failureratesTrace store: failures plus sampleTrace storefailures plussampleCohort analysis: group failuresCohortanalysisgroup failurescountfinished traceskeepexplain failures

    How to read this: the top path measures how often things fail and the bottom path explains why. Do not read rates off the bottom path, because it keeps a deliberately skewed sample.

    Tail-based sampling is the usual answer for LLM systems, but it biases the stored set. Invented example: 5,000,000 requests a day, 0.4% failing (20,000), and you keep every failure plus 1% of successes (49,800 of the 4,980,000). The stored set shows 20,000 / 69,800, about 28.7% failures. The truth is 0.4%. Compute rates from always-on counters that count every request, or re-weight each kept success by 100, the inverse of its sampling rate. Use the stored traces to explain failures, not to measure how often they occur.

    TIP

    Picture it: A shop's security camera keeps the footage of every incident plus a few random quiet hours, to save space. That footage is ideal for working out what went wrong. But count incidents per hour from the saved clips alone and the shop looks like chaos. The door counter, which clicks for every visitor, gives the true rate. Where it stops matching: your counters must count every request, not a sample.

    Failure-cohort analysis. Individual failing traces look like random bad luck. A systemic problem shows up only when you group failures by attributes and compare each cohort's share of failures with its share of traffic. Useful cuts: prompt version, model, tenant tier, language, input length bucket, attachment type, tool used, retrieval source, region and time since deploy.

    SELECT cohort, COUNT(*) AS requests, SUM(failed) AS failures,
           SUM(failed) * 1.0 / COUNT(*) AS failure_rate
    FROM task_outcomes
    WHERE day = '2026-12-02'
    GROUP BY cohort
    ORDER BY failure_rate DESC;

    Invented example: of 2,000,000 requests, a cohort of long scanned PDFs is 80,000 (4%) and holds 2,400 of 3,000 failures (80%). Its failure rate is 3%; the rest is 600 / 1,920,000, about 0.03%. No single trace revealed that.

    NOTE

    Exam angle. Failures are scattered and each trace looks different. The answer aggregates by cohort. Common trap: reading more individual traces. Ten more anecdotes do not show a pattern that spans thousands of requests.


    3.20 Refusals as a failure class

    Domain 4 topic: treating a refusal as its own kind of failure, separate from errors and from wrong answers. As 3.2 noted, a refusal comes back as a normal successful response with a refusal stop reason, so HTTP dashboards miss it.

    A refusal is not always a defect. Sort each one:

    Kind Meaning Response
    Correct refusal The request really is out of bounds Show a clear message; no fix needed
    False refusal A legitimate request was declined A product or prompt problem to fix
    Mid-task refusal It happens inside an agent loop Check for partial side effects, then stop cleanly or hand off

    Do not retry a refusal in a loop. A rate limit (429) is transient and backoff helps. A refusal is a decision about this input, so re-sending the same request mostly repeats it. Handle stop_reason explicitly and keep refusals out of the generic retry wrapper (module 2).

    Diagnosing a rise in refusals. Chart the refusal share by prompt version, feature, model and input cohort (3.19). If it jumps at a deploy, read the refused traces. Common causes are a prompt change that removed the context explaining a legitimate use, retrieved or tool text that contained alarming content, and a model change. The fix is to restore truthful context about the deployment's purpose, then verify on a golden set that includes legitimate borderline requests alongside requests that should still be refused. Do not "fix" it by rewording user requests until one passes, because that works around a safety behaviour instead of resolving the cause. If you believe a refusal is wrong, collect the request id and report it through the provider's support channel.

    For the user, give a graceful fallback: a plain message, a human route, or an alternative action.

    NOTE

    Exam angle. Refusal share rose from 0.2% to 3% after a prompt release. The answer compares prompt versions and reads the refused traces. Common trap: adding retries, or alerting on 5xx rates that never moved.


    3.21 Retrieval-grounding failures by stage

    Domain 4 topic: finding which stage of a retrieval pipeline lost the answer. "The model hallucinated" is rarely the first diagnosis to accept.

    Follow one failing question through the stages, using the chunk ids from 3.15:

    Question to ask If the answer is no
    Is the correct passage in the corpus and current? Content or ingestion problem: missing, stale or superseded document
    Is it among the retrieval candidates? Retrieval recall: query formulation, chunking, embedding or filter
    Does it survive reranking and rank high enough? Ranking problem
    Is it present in the final prompt, untruncated? Context assembly: token budget, ordering, truncation
    Does the answer use it correctly? Generation or prompt problem: ignores, contradicts or over-extends the evidence
    Are the citations real? Citation check (3.15)

    Work down the table and stop at the first "no". Fixing generation when retrieval never found the passage changes nothing.

    Invented example: a review of 200 failed questions finds 120 where the right chunk was not among the candidates, 50 where it was retrieved but ranked out, 10 lost in context assembly and 20 used wrongly by the model. The biggest lever is retrieval recall (120 of 200, 60%), not prompt wording.

    The "I don't know" path matters too. When the passage is absent, a grounded system should say it cannot find support, not fill the gap. Count how often the answer was given with no supporting chunk in context; that is a groundedness failure even when the answer happens to be right.

    NOTE

    Exam angle. An answer cites an old policy. Check whether the superseded document was still indexed and ranked first. Common trap: rewriting the prompt to say "use the latest policy" when the old document is what retrieval returned.


    3.22 Diagnosing multi-agent and non-deterministic failures

    Domain 4 topic: failures that span agents, turns and runs. Each agent in a chain may look fine alone while the system fails, so the cause often sits at a boundary.

    Check the handoffs. In a supervisor and worker design, the task text and context the supervisor passes to a worker are all the worker knows (context isolation). Log the exact handoff payload and the worker's returned result as part of the trace (3.13). Then walk the chain boundary by boundary:

    1. Did the supervisor hold the right facts?
    2. Did the payload to worker A include the constraints that mattered (region, date range, customer)?
    3. Was A's output correct and complete, or did a summary drop something?
    4. Did worker B receive what A produced, unchanged?

    The first boundary where correct information goes in and wrong information comes out is the origin. Typical findings are an omitted constraint, an ambiguous instruction, a lossy summary and two parallel workers returning conflicting values with nothing to reconcile them. Fix these structurally: a validated handoff schema with required fields rather than free text.

    Replay in isolation. Take the captured payload and run only that worker. If it fails alone, the problem is the worker or its tools. If it succeeds alone, look at what differs in the full run.

    Non-determinism needs repetition. One failure proves little and one success proves less. Replay the same inputs several times to estimate a rate. As a rough rule, zero failures in n runs is consistent with a true failure rate up to about 3 / n at 95% confidence. With 20 clean runs that is still about 15%, so "it passed 20 times" does not show a fix. Use larger runs, or the golden set, before declaring it resolved.

    Separate the layers: model output (wrong given the payload), harness (wrong payload or lost context), tools (wrong result) and data (wrong source).

    NOTE

    Exam angle. Final answers sometimes use the wrong region and each agent's logs look plausible. The answer compares handoff payloads at each boundary. Common trap: swapping the model of the last agent in the chain, which only reports the earlier error.


    3.23 Incident communication and the learning loop

    Domain 4 topic: what you say during an incident, and what you change afterwards so it does not return.

    Communication. Name one incident lead and one person who communicates, so engineers are not answering messages. Updates follow a fixed shape: what is affected, what is known, what is not yet known, what is being done, and when the next update comes. Send them at the promised time even if the news is "no change". Keep them factual: do not guess a cause or promise a repair time you cannot back. Write for the audience: support needs scripts and workarounds, leadership needs impact and risk, customers need plain language. When the incident harmed users (wrong refunds, wrong answers acted on), tell the affected ones and state the remedy.

    The learning loop. A postmortem is finished only when each finding changes something.

    Output What it contains
    Regression eval The failing inputs and close variants, scrubbed of personal data, added to the golden set. Confirm the new case fails on the broken version and passes on the fix; a test that never failed proves nothing. Wire it into the release gate
    Monitoring coverage Ask how it was detected and how long that took. If a customer found it, add the missing signal (a cohort metric, a sampled quality SLI, a zero-tolerance alert) and record time to detect and time to mitigate
    Postmortem findings Timeline, contributing factors (technical and process), what worked, and follow-ups with an owner and a due date, tracked until closed

    Figure 9. From incident to regression eval

    Incident to regression eval and monitoring loopIncident to Postmortem; Postmortem to Regression eval (failing inputs); Postmortem to Monitoring gap closed (how detected?); Regression eval to Release gate (blocks repeats); Release gate to Production (release); Production to Monitoring gap closed (signals); Production to Incident (next failure)IncidentIncidentPostmortem: findings, ownersPostmortemfindings, ownersRegression eval: must fail firstRegressionevalmust fail firstMonitoring gap closed: new signalMonitoring gapclosednew signalRelease gate: golden setRelease gategolden setProductionProductionfailing inputshow detected?blocks repeatsreleasesignalsnext failure

    How to read this: the top path stops a known failure from shipping again. The bottom path makes the next surprise show up sooner. The red arrow is why the loop never really ends.

    Prefer eval cases that cover the class of failure, not only the exact input. A fix that passes one example and breaks its neighbours is a second incident waiting.

    NOTE

    Exam angle. After a postmortem, which follow-ups matter most? A regression eval that is shown to fail on the old behaviour, plus the detection gap closed with monitoring. Common trap: a follow-up of "be more careful" or a blanket release freeze, which has no owner, no test and no measurable result.

    IMPORTANT

    Remember this:

    • One trace id travels with the request. The API request id is for support tickets.
    • HTTP 200 only says the plumbing worked. Measure the job: stop reasons, outcomes, sampled quality.
    • Read the trace, classify the failure, then change one thing at a time against a frozen golden set.
    • When harm is active, contain first and diagnose second.
    • A postmortem is finished only when it leaves a regression eval, better monitoring and owned follow-ups.

    M3 Checkpoint

    You should be able to:

    • Propagate one trace id through auth, retrieval, model calls and tools, and join it to the API request-id for a call.
    • List the dimensions every model-call span should carry, and compute total input tokens correctly when prompt caching is in use.
    • Explain why HTTP 200 does not mean task success, and name the behaviour metrics that reveal the gap.
    • Distinguish time to first token from total completion time, and say which levers move each.
    • Design an SLO with short and long burn-rate windows, and show with arithmetic how an aggregate hides a failing segment.
    • Define zero-tolerance alerts for safety-critical tool failures and write an audit record that omits sensitive values.
    • Classify a failure and isolate variables with a frozen golden set, changing one thing at a time.
    • Run the incident loop, mitigating first when harm is active, and turn a postmortem into a regression eval.
    • Lay out spans for an agent loop (turns, model calls, parallel tool calls, subagents) and read the critical path.
    • Compute a cache hit ratio from the three input fields, name the usual causes of a collapse, and cost a task rather than a request.
    • Record the evidence needed to trace a grounded answer, and explain why model-written explanations are not an audit record.
    • Choose what to log by default, what to capture only by opt-in, and why zero data retention at the provider does not cover your own logs.
    • Define a quality SLI from sampled, judged, stratified traffic and size the window to the sample.
    • Detect drift after a model change with a behavioural fingerprint, and set per-tenant anomalous-usage alerts with containment.
    • Compare sampling strategies, correct for sampling bias, and find systemic failures by cohort.
    • Treat refusals as a failure class: classify them, keep them out of retry loops, and diagnose a rise by prompt version.
    • Diagnose a retrieval-grounding failure stage by stage and prioritise by where failures concentrate.
    • Locate a multi-agent failure at a handoff boundary, replay a worker in isolation, and judge non-deterministic fixes with enough runs.
    • Communicate during an incident and convert it into a verified regression eval, monitoring coverage and owned follow-ups.

    Where to verify

    Enroll to keep reading

    Lesson 4 of 10 · Claude Certified Developer — Professional

    Trace ids, token and stop-reason metrics, SLOs, segment alerts, golden-set isolation, canary comparison and the incident loop for Claude apps in production.

    In the rest of this lesson

    • 3.9 Same input, different outputs; sudden change, nothing changed
    • 3.10 Canary comparison and config propagation
    • 3.11 The incident loop: mitigate first
    • 3.12 Shadow logging, postmortems and recovery pitfalls
    • 3.13 Spans for agent loops and tool calls
    • 3.14 Cache performance and token cost telemetry

    Enrolling is free. It unlocks every lesson in Claude Certified Developer — Professional, tracks your progress across devices and keeps your quiz scores. The newsletter is optional.

    Ask about this article

    Get answers grounded in this post. AI-generated — based on this article, and may be imperfect.

    Free: CCA Foundations cheat-sheet (PDF)

    The domains, the 3 universal rules, core concepts, and exam-day shortcuts — one page. Enter your email and it's yours, plus my weekly AI-architecture notes.

    No spam. Unsubscribe any time.

    Scaled AI Weekly

    Enjoyed this? Get more like it every Monday.

    Real architecture decisions, LLMOps patterns that survive production, and engineering leadership advice — from 12+ years of building at enterprise scale. Free. No spam. Unsubscribe anytime.

    Get new articles by email

    Free. We email a confirmation link first, and you can unsubscribe from any email.

    Join engineers building production AI systems

    Comments