Error analysis for AI agents is the practice of reading traces, identifying where each run first went wrong, and grouping those observations into failure modes you can evaluate and monitor. A successful run status does not settle whether the agent behaved correctly. In our trip-planning example, every span succeeded, but the planner confirmed a $1,188 booking for a trip that cost $925.
The example uses real model decisions and simulated tools. We follow those runs from manual review to a Laminar Signal, including the disagreements that forced us to tighten our definitions.
Error analysis for AI agents starts upstream
Read forward through each trace and record the earliest relevant failure. Agent mistakes cascade: a bad research result can produce an incorrect booking and then a confident reply. Husain and Shankar's evals FAQ recommends this first-upstream-failure rule; Orq.ai's agent evaluation guide gives the same rationale.
We ran a planner and research sub-agent on 60 booking tasks, then coded each run at its first failure and from its final reply alone. Each column assigns one label per run. These are simulated-workload counts, not estimates of production prevalence.
| Failure mode | First-error coding | Final-reply coding |
|---|---|---|
| Round-trip fare read as one-way | 8 | 0 |
| Asked the user instead of booking | 6 | 7 |
| Handoff lost data | 5 | 0 |
| Picked a pricier option than needed | 2 | 0 |
| Fare search timed out | 12 | 12 |
| Booking error shown to user | Not a first failure | 5 |
| No coded/visible failure | 27 | 36 |
The leading agent mistake was a misread tool contract: research treated round-trip fares as one-way. Six of those eight final replies looked acceptable. Four simulated bookings included an unbooked return in the charge. One declined a $1,872 trip as costing $2,393 against a $2,000 budget. Another declined an infeasible trip for the wrong reason.
Across all agent failures, 9 of 21 replies looked like success or a correct refusal. Final-reply review exposed confirmation and booking symptoms while hiding the fare error.
Sample successful-looking runs too
The planner delegates research to a sub-agent, then calls book_trip. Both used gpt-4.1-mini at temperature 0.7, traced with Laminar's Python SDK on a local self-hosted deployment. Deterministic simulated tools supplied round-trip fares, local-currency quotes and hotels paged by rating. Tasks also covered an ambiguous city, missing hotels and destinations whose fare search always returned a timeout payload.
All 60 traces finished with status success. Sampling only errored traces would have found none of these failures.
Sample across traffic. For a fixed eligible set, ordering by a hash of trace ID gives a repeatable sample. In the SQL editor:
SELECT id, start_time, agent_input
FROM traces
WHERE start_time > now() - INTERVAL 7 DAY
ORDER BY cityHash64(id)
LIMIT 60
agent_input contains the extracted task. Use task extraction to inspect whether the sample covers relevant requests. Include successful-looking runs, refusals and handled tool errors rather than selecting only cases users complained about.
Write the failure before choosing a category
Open each trace in the transcript view. Read the tool arguments and results, including the inputs and outputs at sub-agent boundaries. Write a note with the step, the mistake and its consequence:
- Step: research's second search_flights call.
- Mistake: searched Lisbon to New York for a return leg although fares were already round-trip.
- Consequence: the planner booked the outbound ID and charged $1,188 for a simulated trip that cost $925.
Arize's guide to building agent evals from traces calls this open coding: describe the failure without forcing it into a predefined taxonomy. Our expected traps, including currency and pagination, barely appeared in the main set.
Keep secondary errors in a separate note. In this booking, the planner also miscalculated $221 + $267 + 4 × $176 by $4. Counting both errors as primary would break the one-label-per-run rule.
Decide which process violations count even when the outcome is acceptable. We counted a fare misread on an infeasible trip because the same mistake could change the decision at another budget.
Attribution matters too: 14 of the 21 agent failures began in research and 7 in the planner. Reviewing only the planner's final reply hides that distinction. With multiple reviewers, a labeling queue keeps labels beside traces.
Define binary modes and their exclusions
Group notes about the same problem and write a yes/no definition for each group. This is axial coding. The underlying mistakes can coexist; your counting rule assigns each run one first-failure label. Our initial modes were:
| Mode | Definition | Agent | Traces |
|---|---|---|---|
| tool_timeout | A tool timeout prevented completion | tool | 12 |
| roundtrip_fare_misread | Round-trip fares treated as one-way through a return search, doubled fare or added return fare | research | 8 |
| asked_instead_of_booking | Trip fit the budget and required data was available, but planner asked for confirmation or a choice | planner | 6 |
| handoff_lost_data | A summary dropped a needed ID, or the request to research dropped dates or origin | either | 5 |
| suboptimal_option | A pricier valid option changed the outcome, or the user requested the cheapest | research | 2 |
Document passes explicitly. The agent correctly declined 13 infeasible budgets, requested clarification for five Portland tasks and reported no hotels for two Kyoto tasks. For each budget refusal, the cheapest flight plus the cheapest of all six hotels still exceeded the budget.
Also document the product contract. Asking before booking is a failure here only because the system prompt requires booking without confirmation. A real travel product might require the opposite.
Keep tool failures separate from agent mistakes. Our 12 timeouts came from a simulated provider configured to fail. They do not demonstrate a reasoning defect or establish which reliability fix would work.
Prioritize by frequency and consequence. Fare misreading led the agent modes, and four of its eight runs produced inflated simulated charges. Published taxonomies, including Laminar's taxonomy and MAST, can prompt a review, but they do not define your agent's contract.
Use saturation as a checkpoint, not a guarantee
The sources offer different starting points. Husain and Shankar recommend at least 100 traces and describe theoretical saturation: further review stops revealing modes or changing definitions. Orq.ai suggests saturation often arrives around 50 to 100 traces. Arize says a dozen varied traces can reveal the first useful mode. Jarmak's 2026 paper calls the 100-trace recommendation an unmeasured protocol choice.
In run order, our new modes appeared at traces 1, 6, 14, 21 and 46. The last 14 added nothing. Yet 30 fresh holdout runs revealed two more modes, once each: a planner presented 269 EUR as $269; another summed $434 plus seven nights at $150 as $1,434 instead of $1,484 and booked it.
We missed the addition error on our first read. An automated detector flagged it, and an arithmetic check across confirmed bookings found no other uncoded mismatch.
Track when modes first appear and definitions change. A plateau describes your sample, not a complete failure inventory. Discovery order is not priority: the once-seen addition error still changed the simulated charge.
Automate your codes with a Laminar Signal
People define the codes; a classifier can apply them across more traces. MAST illustrates the importance of that setup: an o1 annotator working against a human-built taxonomy reached Cohen's kappa 0.77 against expert labels with few-shot examples, versus 0.58 zero-shot. Those results do not establish accuracy for your agent.
A Laminar Signal combines an instruction with an output schema. Its agent reads relevant trace steps and returns an event with schema fields and evidence links when it finds a match. No match produces no event.
We put the five definitions and pass conditions into the instruction. An excerpt:
Find the first thing that went wrong in this trip-planning run: the earliest
step where the planner or the research sub-agent made the mistake, not the
final symptom. Pick one failure_mode:
- roundtrip_fare_misread: search_flights prices are round-trip, but the agent
treated them as one-way (searched a separate return flight, doubled a fare,
or added a return fare to the total).
...
Do not report runs that correctly decline an infeasible budget, ask which
Portland the user means, or report that a city has no hotels.
The schema restricts failure_mode to the five codes and includes agent and free-text evidence. Follow the instruction guide, then backfill labeled traces before using the results for monitoring.
Count distinct traces per mode, scoped to one Signal version:
SELECT
simpleJSONExtractString(payload, 'failure_mode') AS failure_mode,
uniqExact(trace_id) AS traces
FROM signal_events
WHERE run_id IN (
SELECT run_id FROM signal_runs
WHERE signal_id = '<your-signal-id>'
AND signal_version = 2
AND status = 'COMPLETED'
)
GROUP BY failure_mode
ORDER BY traces DESC
Editing the Signal instruction creates a new version; filtering only by Signal name would pool versions. For the denominator, count distinct completed traces in signal_runs using the same filters. Version 2 produced 48 failure verdicts over 90 completed traces. These are classifier verdicts, not the manual labels.
Two runs failed initially and completed on retry; their failed rows remained. A failed Signal run is not a no-failure verdict.
Check agreement before trusting the counts
We ran the closed-code Signal on Gemini 3 Flash. Agreement compares failure_mode, with no event treated as no failure, against one reviewer's labels. We did not score the agent field. The reviewer read each transcript once; these labels are a reference to examine, not ground truth. All reported results use the corrected addition-error label.
Version 1 matched 41 of 60 main-set labels, with Cohen's kappa 0.61. It agreed on 11 of 12 timeouts, 7 of 8 fare misreads and all 5 handoff failures. It missed one failing run and raised events on 14 of 27 clean runs:
- Eight handoff flags: the planner retained and applied a budget it had omitted from research instructions, or a summary omitted hotel IDs when no booking followed.
- Six suboptimal-choice flags: research stopped on the first hotel page, but even the cheapest second-page option could not make those declined trips affordable.
These disagreements exposed loose definitions. We revised them using only the main set: lost data must affect what happens next; a cheaper option must appear in a tool result and matter to the choice; timeouts take precedence. You could classify incomplete pagination as a latent defect instead, but write that decision into your rules.
Version 2 matched 58 of 60 main-set labels, kappa 0.95. That is in-sample agreement: those traces shaped the instruction. On the 30 holdout traces, agreement rose from 19 of 30, kappa 0.54, to 27 of 30, kappa 0.86. The remaining mismatches were the two uncoded modes and one ambiguous run.
This is one simulated workload, one reviewer and one classifier model. Crisp definitions performed better here; the numbers do not establish general detection accuracy. Treat events as review leads, inspect disagreements and recheck agreement on fresh traces after instruction changes.
Keep reading for modes the classifier does not know
The closed-code Signal had no label for the holdout's currency slip or addition error. Their absence from its counts said nothing about whether they occurred.
We also ran Laminar's default Issues Signal, which describes problems in free text, on all 90 traces. It flagged 47 of 49 runs labeled as failures, including the addition error that our initial review and closed-code Signal missed.
It also flagged 29 of 41 runs labeled clean. Twelve findings wrongly claimed a one-way-only flight; the fares were round-trip. Nine concerned first-page hotel stops. Issues made the same fare assumption as our most common agent error.
Open-ended detection supplied review leads, but its event count was not a count of our defined failures. Keep reading a fresh sample alongside both detectors so the closed taxonomy does not hide new problems.
Issues is selected by default in onboarding; self-hosted projects start with it. Laminar's clusters group events by meaning. We did not evaluate clustering here, and a cluster that matches no code needs review before becoming a mode.
When an event is wrong, you can discard it with a reason in the trace's Signals panel. Laminar deletes the event and adds that reason to the instruction on future runs; see Signal feedback. Recheck agreement after feedback changes the detector's behavior.
When a spreadsheet is enough
A spreadsheet is enough while you can review the relevant sample manually. Keep the trace ID, first failing step, responsible agent, code and secondary notes in each row. You do not need clustering to discover your first useful mode.
Automate when repeated counting or monitoring exceeds that workflow. Clustering can suggest groupings, but people still need to decide whether each group describes a failure with a testable definition.
Turn the top modes into evals and monitors
Choose checks by count and consequence. Husain and Shankar caution against generic helpfulness or coherence scores because they do not identify a specific failure to fix.
- Fare misreading: try a clearer tool description. For this round-trip contract, test that the agent does not search a separate destination-to-origin leg. Check that total_usd equals the fare converted to USD plus the hotel cost for all nights. That arithmetic check also covers the addition error. See evaluating AI agents for trajectory checks.
- Lost handoff data: try structured fields instead of prose. Define completeness requirements for origin, dates and budget in requests, and needed IDs in summaries. Separately check that booking IDs come from tool results. A completeness check can intentionally be stricter than the outcome-based failure label.
- Unnecessary confirmation: establish whether booking without confirmation is actually the intended behavior, then test that contract.
These are candidate fixes. Track Signal verdicts as a share of traces with completed Signal runs, and review fresh examples before crediting a change. Keep the task mix and detector version comparable; an instruction change can change the measured rate without changing the agent.
Use labeled traces to seed an eval dataset, preserving failures and relevant passes. See production traces to eval datasets and golden datasets for the next steps.
FAQ
How is error analysis different from automatic failure detection?
Error analysis defines what went wrong for your agent. Detection applies rules or models to find more instances. You can use a deterministic check for an exact invariant, such as booking arithmetic, rather than asking an LLM to judge it. See automatic failure detection.
Should an LLM do the open coding?
An LLM can propose notes or groupings, but check the failing step yourself. Husain and Shankar suggest introducing assistance after 30 to 50 manually reviewed traces. BankerToolBench used LLM open coding with human review of the resulting categories. On Who&When, the best method identified the responsible agent with 53.5% accuracy but the failure step with only 14.2%. Do not assume attribution is solved.
Why did failed runs show status success?
In this example, timeout tools returned JSON error payloads that the agent handled rather than exceptions. Fare misreading and incorrect arithmetic also raised no exception. Execution status recorded successful completion while the transcript still contained a task failure. Inspect tool results and decisions alongside status.