Skip to content

3.4 Observability and Monitoring at Scale

A trace records one request in full, from input to response. Server software taught us debugging habits, and those habits fail with LLM systems. The same input can produce different outputs. So a single anecdote proves little, and a re-run proves less. A green uptime dashboard shows nothing about whether the answers are right.

This lesson uses one made-up example throughout: a flooring firm whose Claude assistant retrieves product sheets, calls a stock tool and answers customers. Customers report wrong prices while the uptime dashboard stays green.

Agents make dynamic decisions and behave differently between runs, even on identical prompts. Anthropic’s multi-agent research team reported this behaviour in production: users saw agents “not finding obvious information”. The engineers could not see why until full production tracing let them diagnose failures systematically.

Re-running a failing input to “see if it happens again” is the anti-method: a method to avoid. Without the trace, neither a reproduction nor a non-reproduction proves anything. A wrong flooring quote that is correct on a re-run teaches nothing. Reason about distributions of results, and keep the full context of each request so that any single failure can be explained.

A failure you cannot trace is a failure you cannot diagnose. Capture these per request:

  • prompt version
  • model id
  • retrieved context
  • tool calls and their results
  • token usage
  • cost
  • latency
  • the response

Correlation ids join the stages of a multi-call pipeline (or the iterations of an agent loop) into one record that you can navigate. A trace that covers each call on its own in a five-stage pipeline cannot tell you which stage failed. At the flooring firm, one id joins retrieval, the stock call and the reply.

Suppose the wrong prices began right after a product-sheet refresh, and the model and the latency did not change. The trace shows what retrieval returned. So start at retrieval, not at the model or the temperature.

Nobody reads a million traces. Logging everything forever fails in two ways. It fails on cost. It also fails on privacy, because full prompts and outputs capture user data.

Volume forces a two-tier design. Tier one is cheap aggregate metrics on every request: latency percentiles, token spend, error and refusal rates, and tool-failure rates. Tier two is expensive full payloads on a sample, plus every detected failure. Sampling rates, retention windows and redaction of sensitive fields, such as flooring customers’ addresses, are architecture decisions that you make at the start. Domain 5 covers the compliance requirements that these decisions serve. This objective covers how to design for them.

Uptime, error rate and latency can all be green while the system confidently produces rubbish, as at the flooring firm. A hallucinating system is “up”. Quality needs its own instrumented signal: automated evaluation on sampled production traffic. The evaluation is scored against a rubric or an LLM judge that Domain 4’s formal evals have calibrated. This signal turns “it sometimes makes things up” into a trend that you can measure and set alerts on between formal eval runs. Behavioural monitoring can work at the pattern level without reading individual conversations, and this is how it coexists with privacy constraints.

Distribution shifts appear in cheap metrics before quality complaints arrive, because those metrics count every request. Token spend per request slowly increases. Refusal and tool-failure rates rise. Input lengths drift. Alerts on these metrics detect a broken document refresh (like the flooring firm’s), a prompt regression or changed user behaviour early.

Alert on tail percentiles, not averages. A stable mean can hide a doubled p99, and the users on the tail file the tickets.

The question says that support reports bad answers while engineering sees green dashboards. The right answer adds instrumentation that would detect the failure. The wrong options add more of the metrics that are already green. “Add more uptime alerting” is a wrong option in nearly every observability question. The guide’s Domain 4 sample has the same pattern: confident wrong answers right after a document refresh, while the model and the latency are unchanged. So start at retrieval.

A document-assistant serves 200k requests per day across a five-stage pipeline. Support reports that it sometimes makes things up; engineering sees green dashboards (uptime, mean latency). Engineering needs to find where in the pipeline each invented answer starts and how often it happens, without waiting for users to notice. What should the team build?

  • A. Per-request traces with correlation ids across all five stages, plus automated quality scoring on a traffic sample
  • B. More uptime and latency alerting across all five stages, with tighter thresholds so incidents page the on-call team sooner
  • C. A process where users screenshot bad answers and file them with support so engineering has real failure examples to work from
  • D. Training for staff on writing better prompts so fewer requests trigger invented answers
Answer & explanation

Correct: A

  • A — The trace makes any single failure diagnosable to its stage, and sampled quality evaluation turns sometimes-makes-things-up into a measurable, alertable trend.
  • B — More of the metric class that is already green; infrastructure signals cannot see fabricated answers.
  • C — The question excludes this: it waits for users to notice bad answers. A screenshot also carries no prompt version, no retrieved chunks and no tool results, so it cannot show where the pipeline went wrong.
  • D — Assumes the cause without evidence. Until traces show which stage fails, user behaviour is a guess, and fabrication typically points at retrieval or grounding, not phrasing.