TL;DR
When an AI agent fails mid-task—say, by calling the wrong tool or misreading an API response—asking another large language model (LLM) to explain what went wrong often yields a plausible-sounding story that isn't actually faithful to the execution. This paper shows that a simple, lightweight linear classifier grounded directly in the system's execution traces outperforms frontier LLMs at identifying and localizing agentic failures, runs in under a second on a CPU, and never chokes on long context windows.
What Problem Does This Paper Address?
Modern "agentic" AI systems don't just make a single prediction; they plan, maintain state, invoke external tools, and adapt over dozens of steps. When something breaks, a tiny error in step 3 can snowball into a complete failure by step 15.
To debug these pipelines, developers often turn to high-level explainability methods or ask frontier LLMs to read the logs and summarize what went wrong. The catch? High-level natural-language explanations are not constrained by the actual execution. They can sound coherent while being completely unfaithful to the underlying sequence of events. The authors ask a fundamental question: Is high-level LLM reasoning enough for debugging agentic systems, or do we need diagnostics explicitly aligned with the execution trace?
Methods
To isolate the effect of trace alignment from sheer model complexity, the authors intentionally avoid deep neural networks or clever LLM prompting. Instead, they build a remarkably simple, interpretable pipeline:
- Trace Representation: Raw OpenTelemetry execution traces are converted into a normalized Causal Execution Trace (CET)—a temporally ordered sequence of individual steps called spans (e.g., an LLM call, a tool invocation, or a system operation).
- Feature Extraction: Each span is encoded using standard TF–IDF text features (from its metadata, inputs/outputs, and immediate neighboring spans) combined with simple numeric and pattern-based flags (such as regex indicators for exceptions, rate limits, authentication errors, and whether the span is a tool or LLM call).
- Span-Level Classification: A lightweight one-vs-rest logistic regression classifier predicts the probability of each error category for every individual span.
- Aggregation & Localization: To get a trace-level diagnosis, the model simply takes the maximum probability across all spans for each error category. To localize where the failure happened, it ranks the spans by their predicted probability.
Datasets
The authors evaluate their approach on the TRAIL benchmark, a dataset specifically designed for trace-level reasoning and debugging in agentic systems. TRAIL contains 148 traces comprising 1,987 OpenTelemetry spans (575 of which are annotated with at least one error). The traces come from two distinct domains:
- GAIA: Open-world information-seeking and tool-use tasks.
- SWE-Bench: Complex software engineering workflows.
Key Insights and Ideas
- Alignment beats scale: You don't need a massive, expensive reasoning model to debug an AI agent. A basic linear model over sparse features outperforms frontier LLMs simply because it operates directly on structured, span-level execution data.
- Immunity to context-length limits: When traces get long—especially in software engineering workflows like SWE-Bench—several frontier LLMs (including GPT-4.1, OpenAI o1, and OpenAI o3) fail completely because the serialized trace exceeds their context window. Processing traces span-by-span sidesteps this structural failure mode entirely.
- Interpretable failure signals: Because the model is linear, you can inspect what it learned. In GAIA, authentication errors are dominated by tokens like
403and URL strings, while context-handling failures light up on tool-specific terms likepage_down. - Practical debugging shortlists: Even when the model's #1 ranked span isn't the exact culprit, the true failure span almost always appears in its top 5—giving developers a reliable shortlist rather than a needle in a haystack.
Key Results
Across both domains in the TRAIL benchmark, the trace-aligned linear classifier consistently beats high-level LLM baselines:
- GAIA: Achieves a 0.476 category F1 score (a 22% relative improvement over the strongest LLM baseline, Gemini-2.5-Pro at 0.389) and 0.613 localization accuracy (
hit@1), compared to 0.546 for Gemini-2.5-Pro. - SWE-Bench: Reaches 0.594 category F1 and 0.469 localization accuracy, outperforming all LLM baselines that were able to produce valid predictions without hitting context-length limits.
- Ranking (
hit@5): The true error span appears in the top 5 ranked spans 86.0% of the time on GAIA and 78.1% of the time on SWE-Bench. - Speed: Feature extraction and inference take under 1 second per trace on a CPU, compared to several seconds or tens of seconds for autoregressive LLM baselines.
Limitations and Future Work
The authors note several honest caveats:
- Reliance on explicit lexical cues: The model benefits from obvious error strings (like status codes or exceptions). Subtler failures—such as an agent choosing a suboptimal tool that still executes "successfully"—may be harder to catch without explicit error tokens.
- Small benchmark & zero-shot baselines: TRAIL is relatively small (148 traces), and the LLM baselines were evaluated in a zero- or few-shot setup rather than being fine-tuned on trace data.
- Cross-domain generalization: A model trained only on GAIA drops in performance when tested on SWE-Bench, showing that learned patterns are somewhat domain-specific.
Looking ahead, the authors suggest combining trace-aligned representations (like knowledge graphs) with LLMs to get the best of both worlds: verifiable, execution-grounded diagnostics paired with human-friendly explanations, alongside user studies to test how helpful these tools are for real-world developers.
Summary updated