Skip to content
AgenticAIWiki
  1. Learn
  2. Part 3
  3. 17. Golden sets and error analysis
  4. 17.5

Lesson 17.5 · 5 of 5 · 6 min read · Reviewed 24 Nov 2026

Failure-mode taxonomies

By the end, you can

  • Turn ad hoc failure buckets into a shared failure-mode taxonomy.
  • Write category definitions that two reviewers apply the same way.

In 21.1 you read traces and grouped notes into buckets. That works for one person on one afternoon. When a team reads traces every week, the buckets drift: one person writes “hallucinationHallucination: Output that sounds confident but is false or unsupported by the provided sources.”, another “wrong policy”, a third “made-up fact”, and the counts stop meaning anything. A failure-mode taxonomy fixes the names so the counts can be trusted over time.

What a taxonomy looks like

Keep it small and two levels deep. A support bot might use:

Category Sub-category Definition Example Fix owner
Grounding Wrong fact States something the sources contradict “Returns close after 14 days” (policy: 30) Prompt, retrieval
Grounding Unsupported claim States something the sources do not mention Promises free return shipping Prompt
Retrieval Missing context The right document was not retrieved Answer says “I don’t know” though the policy covers it Search index
Instructions Ignored constraint Breaks an explicit rule in the prompt 300 words when the limit is 120 Prompt
Tools Wrong tool or arguments Calls the wrong tool, or the right one with bad inputs Looks up order 1024 instead of 1042 Tool design
Safety Policy breach Shares data or takes an action it must not Reveals another customer’s address Guardrails

Each row has a definition written as a test (“states something the sources contradict”), an example from a real traceTrace: A record of everything that happened during one request or agent run, as a tree of timed steps., and an owner, so a big count turns straight into work for someone.

Building one from your notes

  1. Open notes. Read 50 to 100 traces and write free-text notes on the first thing that went wrong (17.1). No categories yet.
  2. Group. Cluster similar notes. Merge near-duplicates.
  3. Name and define. Give each group a short name and a one-sentence definition that says what is in and what is out.
  4. Test it. Have a second person label 30 or 40 of the same traces. Compare.
  5. Fix the boundaries where you disagreed, then freeze it as version 1.

Published taxonomies, such as the multi-agentMulti-agent system: A design where several agents with different roles or contexts work together on a task. failure study in the sources, are a useful starting list. Adapt them; your product’s failures will not match anyone else’s exactly.

Rules that keep counts honest

  • Label the first failure. In a trace where a bad retrieval led to a wrong fact, label “Retrieval: missing context”. Labelling both double-counts, and fixing the wrong fact alone treats the symptom.
  • Leaf categories do not overlap. If a failure fits two, sharpen the definitions.
  • Keep an “Other” bucket, and review it monthly. When one kind of note keeps appearing there, it earns a category.
  • Version it. When you add, split or merge categories, bump the version and note it next to the counts. A drop in “Wrong fact” after a split is not an improvement.

Using the counts

The taxonomy turns traces into a ranked list: the biggest categories become new golden-set cases (17.2), code checks or model-grader criteria (chapter 18), and each has a named owner. Track the counts per release, and per slice (17.3), to see whether fixes are working.

Common mistakes

  • Starting with a long list of categories invented before reading any traces.
  • Categories by symptom only (“bad answer”), which point at no fix.
  • Never measuring agreement, so the taxonomy means something different to each reviewer.

Key points

  • A failure-mode taxonomy is a short, agreed list of failure categories, each with a definition, an example and a fix owner.
  • Grow it from real notes (17.1): open notes first, then group, then name and define.
  • Label the first failure in each trace, so counts do not double up and you fix the root cause.
  • Check agreement between two labellers and version the taxonomy like a prompt.
Hands-on labRuns in the Playground

Measure agreement on a failure taxonomy

Check whether two reviewers apply a failure taxonomy the same way, and find the categories that overlap.

You will have: An agreement report for 20 traces labelled by two reviewers: percent agreement, Cohen's kappa and the most confused category pair.

Steps

  1. Read the taxonomy and the two reviewers' labels for the same 20 traces.
  2. Complete agreement so it returns the share of traces where both chose the same category.
  3. Complete kappa: (observed - expected) / (1 - expected), where expected comes from each reviewer's category frequencies.
  4. Count disagreement pairs and print the most common one: that is the boundary to sharpen or merge.

Done when

  • Percent agreement and kappa are both printed.
  • The most confused pair is 'unsupported claim' and 'wrong fact'.
  • The script prints 'sharpen or merge: unsupported claim / wrong fact'.

Open in the Playground No API key needed.

Starter code (Python)
from collections import Counter

TAXONOMY = ["wrong fact", "unsupported claim", "missing context", "ignored constraint", "wrong tool"]
A = ["wrong fact", "missing context", "unsupported claim", "ignored constraint", "wrong fact",
     "wrong tool", "unsupported claim", "missing context", "wrong fact", "ignored constraint",
     "unsupported claim", "wrong fact", "missing context", "wrong tool", "unsupported claim",
     "ignored constraint", "wrong fact", "missing context", "unsupported claim", "wrong tool"]
B = ["wrong fact", "missing context", "wrong fact", "ignored constraint", "unsupported claim",
     "wrong tool", "wrong fact", "missing context", "wrong fact", "ignored constraint",
     "wrong fact", "wrong fact", "wrong fact", "wrong tool", "unsupported claim",
     "ignored constraint", "unsupported claim", "missing context", "wrong fact", "wrong tool"]

def agreement(a, b):
    # TODO: share of positions where a[i] == b[i]
    return 0.0

def kappa(a, b):
    po = agreement(a, b)
    # TODO: expected = sum over categories of (share in a) * (share in b)
    pe = 0.0
    return (po - pe) / (1 - pe)

def confused_pairs(a, b):
    # TODO: Counter of sorted (x, y) pairs where x != y
    return Counter()

print(f"agreement: {agreement(A, B):.0%}")
print(f"kappa: {kappa(A, B):.2f}")
pairs = confused_pairs(A, B)
if pairs:
    (x, y), n = pairs.most_common(1)[0]
    print(f"sharpen or merge: {x} / {y} ({n} disagreements)")
Show a solution
from collections import Counter

TAXONOMY = ["wrong fact", "unsupported claim", "missing context", "ignored constraint", "wrong tool"]
A = ["wrong fact", "missing context", "unsupported claim", "ignored constraint", "wrong fact",
     "wrong tool", "unsupported claim", "missing context", "wrong fact", "ignored constraint",
     "unsupported claim", "wrong fact", "missing context", "wrong tool", "unsupported claim",
     "ignored constraint", "wrong fact", "missing context", "unsupported claim", "wrong tool"]
B = ["wrong fact", "missing context", "wrong fact", "ignored constraint", "unsupported claim",
     "wrong tool", "wrong fact", "missing context", "wrong fact", "ignored constraint",
     "wrong fact", "wrong fact", "wrong fact", "wrong tool", "unsupported claim",
     "ignored constraint", "unsupported claim", "missing context", "wrong fact", "wrong tool"]

def agreement(a, b):
    return sum(x == y for x, y in zip(a, b)) / len(a)

def kappa(a, b):
    po = agreement(a, b)
    ca, cb, n = Counter(a), Counter(b), len(a)
    pe = sum((ca[c] / n) * (cb[c] / n) for c in TAXONOMY)
    return (po - pe) / (1 - pe)

def confused_pairs(a, b):
    return Counter(tuple(sorted((x, y))) for x, y in zip(a, b) if x != y)

print(f"agreement: {agreement(A, B):.0%}")
print(f"kappa: {kappa(A, B):.2f}")
pairs = confused_pairs(A, B)
if pairs:
    (x, y), n = pairs.most_common(1)[0]
    print(f"sharpen or merge: {x} / {y} ({n} disagreements)")
Quick checkTwo reviewers label the same 40 traces with your taxonomy and agree on only 55% of them. What is the most likely cause?
How sure are you?
Pick an answer and how sure you are

Finished the chapter? Take the chapter check.