Automatic Failure Grouping for High-Volume Agent Traces
Clustering repeated behaviors in agent traces reveals failures that scores and alerts miss entirely.

Automatic failure grouping for high-volume agent traces puts thousands of runs into named issue-groups by clustering patterns in what the agents did again and again. Its practical value depends on reading what agents did against what they were instructed to do, rather than grouping error codes or predefined scores. Confirmed groups then become fix targets and regression tests, connecting discovery to prevention.
Why thousands of raw traces cannot be triaged one by one
An inventory-agent hallucination can become a cascade if later actions depend on the invented information. In that scenario, successful tool calls would not establish that the workflow was correct. The failure is in the behavior. Reviewing each trace might expose the deviation, but production agents generate far more traces than a team can inspect individually.
Scorers, threshold alerts, and dashboards narrow the queue only for failure modes defined before release. A failure mode with no check of its own can keep happening without anyone noticing. This creates a problem of visibility as well as volume. Engineers face an undifferentiated stream in which failures may be invisible, and visible failures still lack labels connecting them to related runs. Manual triage cannot provide a reliable discovery process under those conditions.
What automatic failure grouping actually does
Automatic failure grouping changes the unit of investigation from an individual run to a recurring issue. It clusters traces by patterns in what agents did, puts possible groups up for review, and turns confirmed groups into regression tests. Each group represents something the agent repeatedly did wrong. Its name and supporting evidence point toward a fix surface, rather than leaving engineers to reconstruct the relationship between separate failures.
This differs from sorting traces by a score. A sorted queue still asks engineers to inspect individual runs and infer which ones belong together. Grouping makes that relationship the output. It also differs from alerting, which fires when a predefined metric crosses a threshold. A grouping system discovers repeated behavior, including patterns that the team did not anticipate when it configured its alerts.
Why error codes and predefined metrics cannot drive the grouping
A controlled study illustrates the limits of outcome scoring. Fidelity-only scoring flagged none of fifty runs constructed as silent failures by withholding navigation or cross-check tools. A process-aware detector recovered all fifty and flagged none of the ordinary passing runs.
The structural property is “evaluation blindness.” A measurement function is blind to a failure class when a failing state produces a value indistinguishable from a non-failing state. HTTP-level and exit-code monitoring have this limitation when every API call succeeds but the workflow is semantically wrong. A dashboard can display successful calls accurately while leaving the failure entirely unrepresented.
Predefined scorers impose a related boundary on discovery. They can check whether a named failure occurred, but they cannot establish that no unnamed failure occurred. If those scores decide which runs join a cluster, grouping will sort known failures into groups while missing unknown ones. Predefined evaluation remains useful, and evaluation signals cannot substitute for behavioral evidence when the goal is to discover recurring deviations.
The vocabulary problem: why grouping requires a failure taxonomy
Without a taxonomy, clustering produces collections of similar traces with no consistent way to compare them or assign fixes. A five-category operational vocabulary separates planning errors, tool errors, retrieval errors, reasoning errors, and safety and policy violations. These categories map to different surfaces in an agent’s span tree. These categories route fixes.
Planning errors include wrong tool sequences, infinite loops, missing steps, premature termination, and plan-vs-execute divergence. Wrong arguments, tool hallucination, missing error handling, and MCP tool poisoning all fall under tool errors. Retrieval errors cover wrong chunks, missing context, hallucinated sources, and role-switch tokens in retrieved chunks. Reasoning errors include factual or math errors, ignored instructions, and hallucination on grounded context. PII leaks, jailbreak compliance, harmful output, and refusal failures all fall under safety and policy violations.
The vocabulary must also leave room for security-specific distinctions. Microsoft AI Red Team’s v2.0 taxonomy adds seven failure modes found in red team engagements against systems already in use. Those additions extend the vocabulary across supply chains, goals, trust, visual attacks, session context, plugins, and disclosure. Granularity remains an operational constraint. Three categories such as “input, model, output” collapse distinct fix surfaces, while twelve or more can turn review into a dispute over labels. The useful category is one that helps determine ownership, the patch surface, and the regression test.
How observability pipelines automatically group repeated agent failures
An embedding + HDBSCAN pipeline groups traces through representations of their span content. Similarity in those representations provides the basis for clustering, while a judge writes back a taxonomy classification with categories and subtypes. The judge also provides a four-dimension trace score covering factual grounding, privacy and safety, instruction adherence, and optimal plan execution, each scored 1–5. A single immediate-fix string names the change to ship. The resulting cluster therefore combines behavioral similarity with an interpretation an engineer can act on.
With an embedding-proximity approach, vector distance is used to group failures and spot drift. Built-in evaluators for faithfulness, hallucination, and relevance flag traces, giving the clusters material to form around. The pipeline can then group traces from a quietly degrading RAG surface or a batch of similar failing cases. Drift can then be seen across runs, where it would have stayed hidden in separate records. However, the evaluators’ coverage still limits which deviations they flag, so their scores do not remove the need to examine trace content.
A daily-batch variant takes a different route to readable groups. It preprocesses each trace into text, summarizes the trace by facet, and groups similar summaries into topics. This suits teams that can wait at their trace volume and want human-readable cluster labels without having to set up embedding infrastructure. The tradeoff is the timing of discovery. The mechanism offers an alternative operating model alongside embedding-based grouping.
All three approaches require content describing what the agent did, in what sequence, and with which tools. Operational measurements add ways to group traces, but the groups still need that evidence. The OpenTelemetry GenAI spec supplies baseline signals through gen_ai.client.operation.duration for latency and gen_ai.client.token.usage for token consumption. Without those signals, the pipeline cannot reason about speed or cost as grouping dimensions.
Why grouping also needs agent intent, not just trace content
A refund issued after the policy window has closed is a policy violation. The same refund issued while the window remains open is correct behavior, even if the tool calls are identical. Content alone cannot distinguish the two cases. The grouping system needs the instruction or policy that applies to the action to check whether the agent did what it was told to do.
Without that context, similarity can become misleading. A content-only pipeline can merge traces that look alike but fail for different reasons, while separating traces that look different but share a root cause. In the four-dimension scoring approach, instruction adherence gives a clear signal of what the agent was told to do. The label then describes what happened relative to what was expected.
This is also why teams cannot solve discovery by enumerating every failure mode before deployment. The instruction set establishes what counts as a deviation, including deviations that no dedicated scorer anticipated. Intent gives discovery a reference point without requiring an exhaustive catalog of mistakes. It does not remove the need for review. It makes the review about whether behavior departed from the task, rather than whether a run resembles an already familiar error.
The discovery vs. routing tension in failure grouping design
Failure grouping has two jobs that pull its design in different directions. Routing benefits from stable categories, predictable ownership, and known fix surfaces. Discovery needs room for patterns that do not yet have names. Rule-based alerts and predefined scorers serve the first job well, but cannot supply the second by themselves. A pipeline optimized entirely for familiar categories risks treating its taxonomy as the boundary of possible failure.
The strongest objection to taxonomy-driven grouping is practical. It can become a “labeling argument instead of a patch” when reviewers spend their time deciding which bucket owns a trace. Production incidents can also combine several modes, such as a planning error that propagates into a tool error and surfaces as a policy violation. Assigning one category can obscure that causal chain. A convenient label is not necessarily an adequate explanation.
The practical resolution is to separate discovery from routing. Open clustering groups runs into unlabeled or loosely labeled patterns for human review, including runs that finish without an error signal. Taxonomy categories then help teams find the fix surface and regression test for the confirmed cluster. New patterns must get attention even when there is no prior cluster.
How MCP and multi-agent architectures expand the grouping surface
The Model Context Protocol and multi-agent architectures widen the interactions that grouping must cover. Microsoft’s v2.0 update was driven partly by the MCP ecosystem, with 99 CVEs published for MCP-related software in 2025 alone. Tool poisoning moved from theoretical risk to a live attack surface. For grouping, the consequence is not simply more error types. The evidence of failure can be in natural-language tool definitions and in how agents interact across their boundaries.
MCP/Plugin Abuse changes what the agent does through poisoned tool descriptions or instructions that a server injects. The compromise delivers instructions rather than malicious code, making binary-level monitoring blind to the relevant deviation. Inter-Agent Trust Escalation creates a different cross-boundary problem. A compromised agent claims a false identity or higher permissions to an orchestrator that does not verify the claim. The confused-deputy behavior that follows comes through natural language.
Goal Hijacking further complicates the distinction between apparent progress and actual success. Adversarial instructions can appear aligned with the task while redirecting the agent’s terminal goal without fully compromising the underlying agent. No error signal is required. As agents invoke tools and other agents, the unit of failure can therefore become a cross-agent interaction. Pipelines restricted to isolated traces will miss failures whose causal chain spans multiple agents’ spans.
What a grouping system must produce to be operationally useful
A useful cluster record must give an engineer enough context to triage the issue, assign it, fix it, and keep it from coming back without having to look elsewhere. Its minimum contents are a taxonomy category and subtype, a behavioral description of the failing runs, the instruction or policy they departed from, and a single immediate-fix string naming the change to ship. These fields serve distinct purposes. Classification routes the work, behavioral evidence explains the failure, and the instruction context establishes why the behavior was wrong.
The four-dimension trace score gives engineers a severity signal for prioritizing across groups without reading every run. Discovery also needs its own alert condition. The grouping system must automatically flag a new behavioral pattern independently of a known metric crossing a threshold or someone noticing a spike in raw traces.
Teams should route those outputs into their existing workflow, including Slack alerts, coding agent integrations, and CI eval gates. A cluster that requires a separate monitoring console to understand and act on competes poorly with shipping work. The issue-group must lead directly to a change. Once confirmed, it becomes a labeled dataset entry and a regression test in CI, so the next deployment must clear that pattern before shipping. That final step prevents a discovered failure from returning unnoticed and gives the team a basis for distinguishing recurrence from a new mode.
Sources
- Updating the taxonomy of failure modes in agentic AI systems: What a year of red teaming taught us
- New whitepaper outlines the taxonomy of failure modes in AI agents
- Silent Failure in LLM Agent Systems: The Entropy Principle and the Inevitable Disorder of Autonomous Agents
- Model or Harness? An Interaction-Centric Taxonomy for Localizing Agent Failures


