CertPrep
Domain 4 · Lesson 4.1 · 7 min read

Diagnosing Complex Failures

Exam skillComplex Failure Diagnosis

Analyzing evidence from complex production failures, including multi-turn, multi-agent, and non-deterministic failures, to isolate the problem origin among model output, agent harness, tools, and data, including model refusals as a failure class and retrieval-grounding failures.

Isolate where a complex failure began (model output, agent harness, tools or data) using replay, request diffs, repeated trials and agent-boundary comparisons, and treat refusals and grounding failures as failure classes with causes of their own.

What you need to know

When an agent gives a wrong answer, the instinct is to blame the model and change the prompt or the model. In production, many failures begin elsewhere: a harness that truncated history, a tool wrapper that turned a timeout into an empty list, a stale index, a handoff that cut off a specialist's findings, or a renderer that broke a correct table. The skill is to find the first wrong step and the layer it belongs to before changing anything.

The four origins

OriginTypical evidence
Model outputThe exact recorded request, replayed, reproduces the wrong answer
Agent harnessThe request the model received differs from what it should have: truncated history, missing system prompt, mismatched tool_use IDs, cut-off handoffs, dropped tool results
ToolsThe tool returned something misleading: an empty list on timeout, a partial result without saying so, an unreported error
DataThe source is missing, stale or wrong: a document not indexed, a superseded policy, wrong-tenant records

A fifth place is below or after the application: serving infrastructure, or a rendering layer that displays correct output wrongly. Correct classification decides who fixes what.

Techniques that isolate the origin

  • Replay the exact recorded request (same snapshot, system prompt, messages, tool results) several times. If replays are consistently right, the model behaved correctly on that input; look at what was actually sent, or at steps after the model.
  • Diff the requests of differing runs. Different retrieved documents or tool results explain different outputs without any model variation.
  • Repeated trials on fixed inputs. An intermittent failure (one run in eight) must be measured as a rate. Change one variable at a time, holding the snapshot, tools and inputs fixed; a single successful run proves nothing.
  • Compare across agent boundaries. A complete output on one side and a truncated input on the other locates the failure in the handoff code.
  • Follow concentrated signals. A failure that clusters by turn count, language, tenant, product or stop reason points at the component tied to that dimension.

Multi-turn and multi-agent failures

In multi-turn failures, the symptom appears late but the cause is early: a fact given in turn 3 and lost when the harness trimmed to the last 10 turns cannot be recalled in turn 14 by any model. Failures that start beyond a turn threshold suggest a context policy at that threshold (clearing that removes evidence of completed steps, for example).

In multi-agent failures, trace back to the first boundary where something went wrong: a subagent that turned a failed lookup into an estimate without saying so, and a coordinator that then propagated it faithfully.

Refusals as a failure class

A rise in refusals has causes like any other failure. If it starts with a prompt or document change and clusters on the topic that change mentions, the new text is being read as a ban; narrow its wording. Over-refusal of legitimate requests is a quality failure, not a security success.

Grounding failures

Locate the stage: missing or stale data, retrieval recall, ranking, or generation (see lesson 2.4). Check whether the documents exist and are current, then whether the right passage reached the model, before rewriting prompts or switching models.

Loops and repeated calls

An agent that calls the same tool with the same query again and again is usually not getting what it expects: the result looks incomplete or ambiguous, or the harness drops it under load. Check the trace before raising turn limits, which only let the loop run longer.

In the exam

Diagnosis items give evidence from traces, logs and replays. Ask: what did the model actually receive, and was the answer reasonable given that? Pick the conclusion the evidence supports and the fix at that layer. Distractors blame the model by reflex, switch models, add prompt instructions, raise limits, retry, or close the report after one good run.

Check your understanding

Question 1

Ten exact replays of a recorded request all give the correct refund amount. What does this suggest?

Show answer

Answer: D. Consistent correct replays point away from the model and toward the harness or downstream code.

Question 2

An order agent says orders do not exist; the tool returned empty lists, and the service logs show timeouts. What fixes the root cause?

Show answer

Answer: C. The tool layer disguised a failure as a valid answer; no model can tell them apart from the result it received.

Question 3

An HR assistant's refusals rose from 0.4% to 3% after a prompt update about health information, mostly on medical-leave questions. What is the likely cause?

Show answer

Answer: B. The rise began with the prompt change and clusters on its topic, so the instruction is being read too broadly.

Apply it: Diagnose Cobalt's declined messages

Exercise · about 25 minCase: Cobalt Health Network

After a protocol update added a paragraph about protecting mental-health information, Cobalt's triage agent declined to classify 4% of messages about anxiety medication. At the same time, a few urgent messages took over 15 minutes to reach a nurse. The team has traces with stop reasons, tool spans and prompt versions, and can replay recorded requests.

  1. Form a hypothesis for each symptom and say which layer it points to.
  2. Design the test that confirms or rules out each hypothesis.
  3. Propose the fix for the refusals, and how you will know it worked.
  4. Say what you will not do, and why.
Check your work
Show model answer

1. Hypotheses. Refusals: the new paragraph is being read as a ban on discussing mental-health medication (model output responding to a prompt change). Slow urgent messages: a harness or tool issue, for example the search_protocols call timing out and retrying, or the approval queue not prioritizing urgent items (harness or workflow).

2. Tests. Refusals: replay 100 refused requests with the previous prompt version and with the new one, three trials each, everything else fixed; compare refusal rates. Slow messages: read the spans of every urgent message over 15 minutes, grouped by stage (model calls, each tool, nurse queue wait), and compare with fast urgent messages.

3. Fix. Reword the paragraph to say what is restricted (sharing mental-health details outside the care team) and that classifying and drafting replies for the care team is expected. Success: refusal rate on the replay set back to baseline, and the live refusal rate per route back within its band for a week, with no rise in policy-violation findings.

4. Not doing. Switching models (the change began with the prompt), retrying refused messages on another model (routes around a safety decision), and adding keyword filters (would block legitimate questions).

Key termsHandoff

Sources