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

Lesson 17.1 · 1 of 5 · 4 min read · Reviewed 24 Nov 2026

Reading traces to find failure modes

By the end, you can

  • Read traces to find failure modes.
  • Sort failures into buckets and rank them.

Teams often jump to building gradersGrader: The part of an eval that decides whether an output passes, using code, a model or a person.. The faster path is to read outputs first.

The method

  1. Sample 50 to 100 tracesTrace: A record of everything that happened during one request or agent run, as a tree of timed steps., including some flagged by users.
  2. Read each one and write a short note on the first thing that went wrong, in plain words: “quoted wrong refund window”, “asked for order number it already had”.
  3. Group the notes into buckets.
  4. Count and rank.
failure bucket                        count
wrong policy detail                     23  <- work on this first
asked for info it already had           11
too long                                 9
missed second question                   6
tone too casual                          3

Why reading beats guessing

The failures you imagine are rarely the ones that happen most. Reading also shows the first bad step in agentAgent: A system where a model decides its own next steps, calling tools in a loop until the task is done. traces (67.5), which is the one to fix.

What happens next

  • The big buckets become criteria and test cases (17.2).
  • Some buckets suggest code checks (too long, missing field).
  • Some need a model graderLLM-as-judge: Using a language model with a rubric to grade another model’s outputs. with a rubricRubric: A written set of criteria and score levels that a grader applies to each output. (wrong policy detail).

Repeat the reading after each major change. New buckets appear as old ones shrink.

Key points

  • Error analysis means reading real outputs, noting what went wrong in plain words, then grouping the notes.
  • The biggest bucket of failures is usually where to work next.
  • Look at outputs yourself before building any automated grader; you'll find failures you wouldn't have guessed.
Hands-on labRuns in the Playground

Bucket failure notes and rank them

Turn plain-word notes from reading traces into ranked failure buckets that say where to work next.

You will have: A bucketing function and a ranked table of failure buckets for 20 trace notes, with the top bucket named.

Steps

  1. Read the 20 notes written while reading support traces, one note per trace on the first thing that went wrong.
  2. Complete bucket so it maps a note to the first matching bucket, with 'other' as the fallback. Order matters: put the more specific rules before the broad policy one, or 'repeated the whole policy' lands in the wrong bucket.
  3. Count and rank the buckets with collections.Counter.
  4. Read the notes left in 'other' and add one rule if a pattern shows up.

Done when

  • Every note lands in exactly one bucket.
  • The ranked table is printed with counts, largest first.
  • The script prints 'work on first: wrong policy detail'.

Open in the Playground No API key needed.

Starter code (Python)
from collections import Counter

NOTES = [
    "quoted 14-day window, policy says 30", "asked for order number already given", "four paragraphs for a yes/no question",
    "promised free return shipping, not offered", "said sale items can be refunded, they cannot", "asked for email shown in account",
    "repeated the whole policy before answering", "missed the second question", "quoted old refund time of 10 days",
    "asked for order number already given", "tone far too casual for a complaint", "stated wrong exchange rule",
    "answer much too long for a simple question", "invented a loyalty discount", "asked for postcode it already had",
    "wrong policy on gift cards", "missed the second question", "said returns need a receipt, they do not",
    "long preamble before the answer", "asked for name already in context",
]

RULES = [
    ("wrong policy detail", ["policy", "window", "refund", "rule", "promised", "invented", "receipt", "said"]),
    ("asked for info it had", ["asked for"]),
    ("too long", ["long", "paragraphs", "repeated", "preamble"]),
    ("missed a question", ["missed"]),
]

def bucket(note):
    # TODO: return the first bucket whose keywords appear in the note; else "other".
    return "other"

counts = Counter(bucket(n) for n in NOTES)
for name, n in counts.most_common():
    print(f"{name:24} {n}")
print("work on first:", counts.most_common(1)[0][0])
Show a solution
from collections import Counter

NOTES = [
    "quoted 14-day window, policy says 30", "asked for order number already given", "four paragraphs for a yes/no question",
    "promised free return shipping, not offered", "said sale items can be refunded, they cannot", "asked for email shown in account",
    "repeated the whole policy before answering", "missed the second question", "quoted old refund time of 10 days",
    "asked for order number already given", "tone far too casual for a complaint", "stated wrong exchange rule",
    "answer much too long for a simple question", "invented a loyalty discount", "asked for postcode it already had",
    "wrong policy on gift cards", "missed the second question", "said returns need a receipt, they do not",
    "long preamble before the answer", "asked for name already in context",
]

RULES = [
    ("asked for info it had", ["asked for"]),
    ("too long", ["long", "paragraphs", "repeated", "preamble"]),
    ("missed a question", ["missed"]),
    ("wrong policy detail", ["policy", "window", "refund", "rule", "promised", "invented", "receipt", "said"]),
]

def bucket(note):
    for name, words in RULES:
        if any(w in note for w in words):
            return name
    return "other"

counts = Counter(bucket(n) for n in NOTES)
for name, n in counts.most_common():
    print(f"{name:24} {n}")
print("work on first:", counts.most_common(1)[0][0])
print("left in other:", [n for n in NOTES if bucket(n) == "other"])
Quick checkYou have 200 traces of a bot's answers and no grader yet. What should you do first?
How sure are you?
Pick an answer and how sure you are