From Raw Error Logs to Labeled Failure Clusters Without a Human in the Loop
A four-stage pipeline names recurring agent failures, leaving humans to audit labels.

Automatic grouping of recurring AI agent failure patterns requires structured execution traces, semantic evaluation, embedding-based clustering, and LLM-assisted labels. This pipeline gives names to patterns across failures so teams can diagnose and test them without reading every trace by hand. The defensible goal is automated per-trace processing with oversight of label quality.
Why traditional error monitoring misses most agent failures
Application performance monitoring instruments the container through request duration, exception counts, CPU, and memory. Those signals show whether a service is running. They do not show whether an agent chose the right action. An agent can call the wrong tool with valid arguments and complete the request successfully, leaving conventional monitoring with no indication that the task failed.
Malformed tool output creates a deeper problem when it silently corrupts working memory. Every step that follows can use poisoned context while the infrastructure keeps running as it should. The failure then reaches the team through support tickets rather than an operational alert, hours or days after the agent has acted at scale. To catch these failures, teams need to evaluate task quality as well as monitor error logs.
What agent failures actually look like and why they need labels
Six failure modes recur across production agents, including tool misuse, context loss, goal drift, retry loops, cascading errors in multi-agent systems, and silent quality degradation. These are semantic categories. AgentScope’s 2026 taxonomy organizes failures into three dimensions according to where they appear in a trajectory. Reasoning covers internal decision-making and context use, Control-flow covers orchestration and termination, and Action covers execution through tools or environments. This structure gives clustering a useful level of abstraction beyond the wording of individual bad answers.
Detection and attribution remain separate problems, however. A final answer can expose a failure whose cause lies several steps earlier, so diagnosis must localize the first unresolved critical failure step. The AGENTRX framework’s 2026 evaluation reports a 75% improvement in failure localization over its own judge baselines, with improvement in root-cause categorization. Labels make that distinction operational by connecting recurring failures to the prompt, tool schema, retrieval index, or orchestration logic that needs attention. Without them, teams go back to prompt-tweaking without knowing the cause and making fixes without regression tests to check them.
Why scale makes manual triage structurally impossible
A production agent processing thousands of customer requests overnight generates more execution history than a team can read trace by trace. Silent failures form a background rate spread across different semantic categories, while traditional review workflows assume a manageable set of exceptional events. A flat list of hundreds or thousands of failures does not reveal which pattern is growing, which tool is implicated, or which problem has appeared before.
AgentPProf identifies the structural gap between per-execution debugging and cross-run profiling. Span trees help explain a single execution, but aggregation requires grouping by task intent or workflow phase across runs. Without that grouping, each new trace gives teams more to review but may tell them no more about what went wrong. The operational cost is delay, during which the agent continues acting incorrectly in customer-facing workflows.
How do observability pipelines automatically group recurring agent failures?
The pipeline runs through four stages, which are trace collection, embedding, clustering, and LLM-assisted labeling. Trace collection records the execution path through tool invocations and results, prompts, intermediate outputs, and the final outcome. The task is the unit of analysis. Completion rate, step economy, and tool selection accuracy describe its success more usefully than an HTTP status code. Semantic evaluation checks task quality to find failure cases in those traces.
For LangGraph, OpenInference records node executions as spans, LLM calls as child spans with gen_ai.* attributes, and tool calls as execute_tool spans. The OpenAI Agents SDK provides built-in tracing for execution visibility and integrates with MCP for external tool connectivity. The path captured by these mechanisms gives the grouping stage evidence to tell when different mistakes led to similar outputs.
Embedding uses the user query, agent response, and trace summary to turn each failure case into a vector representation. Surface wording no longer defines the grouping. Two different answers can become candidates for the same cluster when their trace summaries reveal a shared problem, such as retrieval returning empty results. This is the departure from log-based matching, because semantic similarity can connect failures that do not share an error message.
Clustering then groups those representations using HDBSCAN, KMeans, or LLM-driven topic discovery. The output is a population of candidate patterns. AgentPProf’s recursive operation segmentation demonstrates how trajectories can be divided into task-bounded segments with hierarchical attribution, providing a structural basis for comparison across runs. Comparing clusters across prompt versions can also reveal which groups grew after a change, without requiring manual comparison of before-and-after failure lists.
Finally, a reasoning LLM receives the inferred failure reasons within each cluster and generates an interpretable semantic label. A prompt ensemble, in which the model proposes multiple phrasings of its clustering prompt, can improve robustness against prompt sensitivity. The label names a concentrated pattern of evidence. That is a narrower task than asking a judge to detect a silent failure reliably in each isolated trace.
Where automated labeling reaches its limits and how to handle them
Cluster-level labeling does not eliminate the weaknesses of LLM evaluation. Individual silent failures remain difficult to detect reliably. Grouping concentrates evidence for naming a pattern, but it does not justify treating every inferred cause as correct. The defensible design therefore combines automated labeling with sampled human review of a small fraction of labeled clusters. That review validates label quality without restoring the per-trace bottleneck.
“Nine Judges, Two Effective Votes: Correlated Errors Undermine LLM Evaluation Panels,” published in 2026, finds that reliability does not increase linearly as more judge models are added. Correlated errors can leave a larger panel agreeing on the wrong conclusion. Better cluster-level signal is therefore more useful than treating model count as a proxy for confidence.
Labels also need maintenance as agent behavior and user inputs change. A cluster once labeled “tool timeout” may absorb a different failure mode, so periodic re-clustering is necessary. Priority must reflect consequences as well as frequency. A low-frequency refund failure can outweigh a frequent FAQ failure, making business-impact weighting part of triage. Removing human review from each trace is achievable, while removing oversight of label quality and operational priorities is the wrong goal.
What labeled clusters feed into through alerting, diagnosis, and fix verification
A new cluster after a prompt change, or sharp growth in an existing one after deployment, should reach the team in Slack or incident tools with its label and representative traces attached. Periodic review is particularly weak for policy violations, where systematic failures can remain undiscovered for months.
Lyft’s customer-support agent platform traces every invocation across development, staging, and production. It enriches traces with agent name, user type, intent, and conversation ID, then uses production dashboards for run volume, error rates, latency, and evaluator scores. That context makes an alert easier to interpret. It connects the grouped failure to the agent and workflow involved rather than presenting an unexplained increase in bad outcomes.
Diagnosis then returns from the cluster to representative execution paths. The label narrows the search, while the trace supplies the tool call, prompt segment, or earlier step where the failure originated. Adaptive Influence Graphs for Failure Attribution in Multi-Agent Systems shows how research in 2026 is moving from flat logs toward trajectory-level causal graphs. AgenTracer uses counterfactual replay to annotate failed multi-agent trajectories automatically, producing evidence usable in diagnosis.
The same context can move into a fix workflow. A labeled cluster, representative traces, and a root-cause hypothesis can pass over MCP to a coding agent with the relevant prompt or tool schema and fix target. Teams can then use representative traces as regression evaluation cases without writing assertions by hand for every failure mode. Verification tests whether the named pattern returns after a fix, connecting production detection to regression prevention.
How this pipeline behaves in production domains where silent failures have the highest stakes
An agent can produce a plausible answer when retrieval finds nothing authoritative, while the underlying failure recurs across differently worded customer requests. Clustering can group those cases by the shared failure to retrieve authoritative information. Intercom’s Gaia reads ticket data to find requests that keep going uncovered, escalations that were not needed, and gaps in knowledge, then proposes Skills and Actions to address them. Every change requires explicit approval before going live, illustrating how automated detection can feed a controlled fix process.
Financial workflows place stronger demands on the execution record. Once an agent mutates a record, triggers a payment, or contacts a customer, teams need a tamper-resistant history of what it saw, decided, and called, including the policy checks that allowed the action. Labeled clusters give compliance teams an organized account of recurring failure modes. Their usefulness depends on the underlying trace history, because a label alone is not an audit trail.
CRM automation exposes a related problem across system boundaries. CRM, billing, and ticketing systems can use subtly different definitions for fields, leaving an agent vulnerable to context loss as it moves between them. Individual bad outcomes can appear unrelated at first. Grouping their traces makes the cross-system inconsistency visible as a recurring cause. Across these domains, automation is most valuable where costly failures repeat and the same diagnosis can inform more than one correction.
What running this pipeline requires in practice and where teams get started
For teams implementing the pipeline, structured instrumentation comes first. Final inputs and outputs cannot reveal an uncaptured intermediate failure. The required trace includes each tool invocation, its arguments and result, the model prompt, and intermediate outputs at each step. OpenInference provides instrumentation for LangGraph and LangChain, while built-in tracing covers the OpenAI Agents SDK execution path. These are practical entry points for collecting useful evidence.
Evaluation cost then determines how much production traffic can receive continuous scoring. Small language model evaluators built for this task can let teams afford to score more traffic, while the cost of frontier LLM-as-a-judge evaluation can push them to use sampling. Coverage is an architectural trade-off. A pipeline needs enough evaluated failure cases to expose recurring patterns, but choosing a costly evaluator does not by itself resolve the reliability limits of per-trace judgment.
For clustering, HDBSCAN is a reasonable default when a team lacks a predefined failure taxonomy because it does not require a fixed number of groups. Teams with known categories can use KMeans or LLM-driven topic discovery seeded with category labels. Labeling should operate on the cluster’s traces and inferred failure reasons rather than as a separate naming exercise for every trace. This concentrates evidence and reduces labeling cost. Sampled validation and periodic re-clustering keep that choice from becoming an assumption that labels remain correct indefinitely.
The final implementation choice is where the output goes. Alerts belong where teams work, diagnosis and fix context can reach an MCP-connected coding agent, and representative cases belong in an eval store. Hand-written assertions for every failure mode, offline benchmark suites, and per-trace human review are processes this pipeline can replace or reduce. The first useful clusters provide the starting material. As they become regression evals, production failures generate the tests that make the next iteration faster.


