Source-linked AI summary
Diagnosing with Insights: Structured Analysis of Agent Failures via Behavioral Abstractions
Jiayi Bi, Yanjie Gao, Yuanmin Xie, Liqun Li, Tianyin Xu, Fan Yang, Mao Yang
TL;DR
LLM-agent failures are difficult to diagnose because they unfold across long trajectories, while traditional software debugging and standalone LLM judges have important limitations. AGENTSCOPE combines structured Reasoning-Action Graphs, neural invariants, and LLM-guided reasoning, and it substantially outperforms prior approaches on Who&When and AgentErrata while producing more interpretable diagnoses.
Problem
Long, complex agent trajectories make failures difficult to locate manually, while traditional software diagnosis and sole LLM-based approaches provide inadequate coverage or reliability.
Method
AGENTSCOPE abstracts trajectories into Reasoning-Action Graphs and uses neural-invariant checking with LLM-guided reasoning to diagnose failure steps and types.
Results
AGENTSCOPE substantially improves failure localization and attribution over prior approaches across the Who&When benchmark and AgentErrata.
Takeaways & Limitations
Structured behavioral abstraction and invariant-guided reasoning provide a promising foundation for localized, auditable, and interpretable agent debugging.
Takeaways & Limitations
Who&When annotates failure steps but lacks explicit failure-type labels and can overemphasize early mistakes that agents later self-repair.
Abstract
from arXiv · showhide
With the proliferation of LLM agents, the ability to understand and diagnose failures in agents is essential to achieving superior effectiveness and trustworthiness. As agent failures often manifest via long and complex trajectories, manually finding the needles in the haystack is untenable. However, traditional diagnosis techniques for software bugs can hardly address LLM agent failures, while completely relying on LLMs as the judge yields unreliable diagnosis results. To overcome these challenges, this paper presents AGENTSCOPE, a new neuro-symbolic approach for agent failure mode diagnosis. The key principle of AGENTSCOPE is to abstract agent behavior, based on its trajectories, into structured representations. Furthermore, AGENTSCOPE introduces the concept of neural invariants to specify agent behavior properties. AGENTSCOPE leverages LLM-guided reasoning atop the structured representation against neural invariants to pinpoint both the failure step and its type in the trajectory. We show the effectiveness of AGENTSCOPE on publicly available agent failure datasets (Who&When) and a more comprehensive dataset created by us (AgentErrata), where AGENTSCOPE significantly outperforms the current state of the art in fault localization and attribution accuracy. Our work shows that integrating structured abstractions with LLM-guided reasoning enables effective, reliable, and interpretable diagnosis for agent failures.
1 INTRODUCTION
LLM agents can fail across long, multi-step reasoning and action trajectories, making diagnosis difficult. AGENTSCOPE addresses this with structured behavioral abstractions, neural invariants, and LLM-guided reasoning for localized and attributable diagnoses.
- Motivation: LLM agents operate across complex, multi-step interactions with tools and environments.Examples include API calls, code synthesis, database queries, and cooperation with other agents.
- Motivation: Failures may arise during reasoning or action execution, cascade through runtime behavior, and eventually disrupt task execution.The resulting trajectories can be prolonged and context-heavy, making manual fault localization difficult.
- Diagnosis gap: Traditional software-bug diagnosis struggles with agent failures rooted in fuzzy reasoning, invalid contexts, and instruction-unfollowing across multiple steps.These failures entangle neural and symbolic paradigms rather than remaining confined to code and program execution.
- Diagnosis gap: Sole LLM-based diagnosis is unreliable because models struggle to capture multi-step behavior and maintain consistent causal invariants.The strongest reported model, GPT-5.1, achieved 18.15% accuracy on the failure-attribution datasets.
- AGENTSCOPE: AGENTSCOPE abstracts trajectories into Reasoning-Action Graphs and applies neural invariants with LLM-guided reasoning to diagnose failures.It supports both failure localization, which identifies the root-cause step, and failure attribution, which predicts the failure category.
- Evaluation: AGENTSCOPE improved localization accuracy across Who&When datasets and achieved 28.38% to 54.13% accuracy on AgentErrata.The evaluation also reports improved attribution interpretability over state-of-the-art approaches.
2 BACKGROUND
The paper organizes agent failures by where they manifest in a trajectory: reasoning, control-flow, or action. This taxonomy provides an interpretable framework for understanding and diagnosing diverse agent misbehaviors.
- Failure taxonomy: The taxonomy divides agent failure modes into Reasoning, Control-flow, and Action dimensions.The dimensions identify where a failure manifests in the agent trajectory.
- Reasoning: Reasoning failures concern internal decision-making and context utilization.They include Insufficient Context, Wrong Context, Instruction Unfollowing, and Context Miss.
- Control-flow: Control-flow failures concern execution orchestration, step transitions, and termination.They include Termination Miss, Premature Termination, and Step Loop.
- Action: Action failures concern executing decisions through external tools or environments.They include Action Mismatch, Invocation Issue, and Execution Failure.
- Taxonomy basis: The taxonomy is derived from empirical analysis of failure trajectories and existing community categorizations.The table summarizes the resulting agent failure patterns.
3 METHODOLOGY
AGENTSCOPE transforms agent trajectories into structured Reasoning-Action Graphs and analyzes them with neural invariant checks. Its staged workflow constructs abstractions, detects candidate failures, and selects a traceable decisive error.
- 3.1 BEHAVIORAL ABSTRACTION: ReAG represents each agent trajectory as a directed acyclic graph whose vertices are individual steps and whose edges encode control or data dependencies.Vertices are instrumented from API calls, tool interactions, and system logs, then refined through semantic parsing.
- 3.1 BEHAVIORAL ABSTRACTION: Each ReAG vertex stores a step identifier, agent role, operational content, and an Intermediate Semantic Representation that supports trajectory analysis.The ISR addresses redundancy and long-context challenges by organizing semantic information for downstream modules.
- 3.1 BEHAVIORAL ABSTRACTION: The ISR separates intent and context, reasoning and action, and signal and validation, capturing complementary semantic aspects of each step.These components encode task goals and step purpose, decisions and tool interactions, and validation-related signals.
- 3.2 NEURAL INVARIANTS: Neural invariants formalize agent behavior properties, while LLM-guided reasoning detects violations, localizes where failures manifest, and classifies their types.Unlike traditional symbolic invariants, the neural functions can evaluate semantic conditions using structured, task-specific prompts.
- 3.2 NEURAL INVARIANTS: For Action Mismatch, aligned() evaluates whether an action matches the preceding purpose, uses an appropriate tool, and advances the task.A violation can indicate tool misuse, missing or incorrect actions, or hallucinated progress; the function is implemented as a binary classifier when using an LLM judge.
- 3.3 IMPLEMENTATION: AGENTSCOPE uses three stages: ReAG construction, failure-mode detection with evidence-retaining invariant checks, and decisive error judgment over candidate failures.The final stage selects a root-cause failure rather than simply the first anomaly, while the staged design aims to improve reliability, interpretability, and extensibility.
4 EXPERIMENTS
The experiments evaluate AGENTSCOPE on Who&When and AgentErrata, using step- and failure-mode-level diagnosis metrics. They also define dataset scope and explain why some datasets and metrics are excluded.
- Benchmarks: Who&When contains 184 human-annotated trajectories for failure localization, split into 126 Algo-Generated and 58 Hand-Crafted traces.
- Benchmarks: AgentErrata labels failure steps and types while ensuring injected errors cause task failure, supporting broader evaluation of debugging tools.
- Evaluation Metrics: The evaluation uses step-level accuracy, tolerance-aware step-level accuracy, and classification accuracy to measure localization and failure-mode attribution.
- Evaluation Metrics: Agent-level accuracy is omitted because step-level metrics already identify the responsible agent, while agent-role imbalance can inflate agent-level scores.
- Evaluation Metrics: Table 2 reports SLAT (%) across backbone models and benchmarks, with higher values indicating better performance.
5 RESULTS
AGENTSCOPE improves agent-failure localization and attribution by structuring trajectories, checking failure modes, and preserving evidence across multi-stage diagnosis. It also maintains strong cross-model performance, though runtime grows with trajectory length and call volume.
- Failure localization: 30.03% at T±0 on AgentErrata, versus 8.91% for W&W STEP-BY-STEP and 2.09% for ALL-AT-ONCE, with GPT-4o without solutions.At T±3, AGENTSCOPE reaches 49.83%, compared with 25.74% and 23.69% for the baselines.
- Failure localization: 25.86% at T±0 and 34.48% at T±3 on Who&When Hand-Crafted with solutions, surpassing both evaluated baselines.Without solutions, the structured graph and invariant-guided candidate preservation remain robust on AgentErrata and Who&When Hand-Crafted.
- Failure attribution: 28.38–31.35% Step-Level Accuracy versus 1.98–3.63% for the baseline, an 8–16× gain on AgentErrata.The results associate the improvement with better temporal alignment in long-horizon trajectories.
- Failure attribution: 41.58–45.87% Classification Accuracy versus 18.15–20.63%, showing improved disambiguation among competing failure modes.Performance remains stable with or without ground-truth solutions.
- Base-model robustness: 30.03%, 31.35%, and 34.98% SLA across GPT-4o, GPT-5.1, and DeepSeek-V3.2, spanning only 4.95 percentage points.The baselines show greater model sensitivity, while ALL-AT-ONCE remains consistently weak across models.
- Runtime overhead: Step Loop consumes approximately 85 seconds because pairwise segment comparisons make its LLM-call count scale quadratically with candidate windows.Invocation Issue and Execution Failure each use approximately 17 calls per trace, while Wrong Context uses approximately 6 calls and about 30 seconds per trace.
6 RELATED WORK
Prior work examines agent failures through taxonomies, LLM-based identification, and model-based detection, while AGENTSCOPE instead structures execution trajectories for interpretable diagnosis.
- Agent-failure research highlights tool misuse, hallucinated goals, and premature termination in complex planning, navigation, and tool-use tasks.
- Existing studies classify mistakes, identify failure steps with LLM reasoning or judges, and fine-tune models to detect failures automatically.
- AGENTSCOPE differs by encoding execution trajectories into structured behavioral abstractions for more interpretable and precise step-wise diagnosis.
- LLM as a Judge: LLM-as-judge systems evaluate quality, correctness, or alignment, but can be unreliable or inconsistent for nuanced reasoning and domain-specific instructions.
7 CONCLUSION
AGENTSCOPE diagnoses LLM-agent failures by converting heterogeneous trajectories into ReAGs, checking neural invariants, and selecting the decisive error behind degraded outcomes. Across two benchmarks, it achieves stronger localization and attribution than prior baselines while supporting fine-grained failure classification.
- AGENTSCOPE abstracts long trajectories into ReAGs, checks neural invariants, and selects the decisive error explaining the final degraded outcome.
- Across Who&When and AgentErrata, AGENTSCOPE achieves substantially stronger failure localization and attribution than prior baselines.
- The framework also supports fine-grained failure-mode classification and more localized, auditable, and interpretable diagnoses.
A NEURAL INVARIANT VIOLATIONS
This section defines neural invariants and explains how their violations appear in agent trajectories.
- Neural invariants specify behavioral properties whose violations can be identified in agent trajectories.
- The section connects invariant definitions with observable violation manifestations during trajectory analysis.
- Invariant checking provides the basis for analyzing whether agent behavior satisfies defined properties.
A.1 WRONG CONTEXT
Wrong context concerns reasoning based on irrelevant, fabricated, or improperly assumed information. AGENTSCOPE evaluates ambiguity clarification and contextual grounding through two judging functions, whose disjunction defines the violation.
- Wrong context occurs when an agent uses irrelevant, fabricated, or improperly assumed information in reasoning.
- The diagnosis checks whether the agent failed to clarify ambiguous user input or hallucinated prior context and tool results absent from checked windows.
- The wrong-context invariant is violated when either failedToClarify(usert, outputw) or hallucinated(outputw, W1, . . . , Wm) holds.
- Such a violation indicates reasoning from an unsupported or improperly clarified contextual state that may lead to downstream errors.
- Instruction unfollowing is separately defined as an output failing to satisfy extracted instruction requirements.
A.3 INSUFFICIENT CONTEXT
The section formalizes agent failure modes as behavioral conditions checked over ReAG trajectories, covering context handling, termination, looping, action alignment, tool invocation, and execution outcomes.
- Context failures: Insufficient context flags a claim of missing information only when the required evidence is genuinely absent from checked context windows.The invariant examines candidate claim nodes and uses infoAbsent over backward context windows.
- Context failures: Context miss detects claims that information is missing despite its presence, or definitive conclusions reached without contextual grounding.Its invariant combines infoPresent with confidentUngrounded to identify mishandled context.
- Termination and control flow: Termination failures identify either continued activity after a final answer or stopping before required end conditions are satisfied.Termination miss checks post-output activity, while premature termination evaluates the final output against endReq(H).
- Termination and control flow: Step loops detect repeated semantic segments without observable progress, while action mismatch detects actions that conflict with preceding reasoning intent.The checks compare roles, purposes, actions, tool choices, and outcomes, and can identify stagnation, tool misuse, missing actions, or substitutions.
- Tool failures: Invocation and execution failures distinguish invalid tool calls from tool operations that return errors or otherwise fail to complete.Invocation checks schema compliance and dependencies; execution checks responses for exceptions, empty results, timeouts, permission denials, or related non-success outcomes.
B FAILURE MODE DISTRIBUTION OF AGENTERRATA
AgentErrata organizes failures across reasoning, control-flow, and action categories, then further divides them into ten fine-grained modes. Its relatively balanced composition is intended to test diverse failure mechanisms rather than one dominant pattern.
- Evaluation rationale: The dataset’s failure composition characterizes structural diversity, which determines the difficulty of trajectory-level localization and attribution.Distributional analysis is presented as important because trajectory errors are heterogeneous and complex.
- High-level categories: AgentErrata groups failures into reasoning-related, control-flow-related, and action-related categories with a relatively balanced distribution.The balance is intended to avoid evaluation bias toward a single reasoning pattern.
- Fine-grained modes: The fine-grained failure modes are IC, WC, IU, CM, TM, PT, SL, AM, II, and EF.Their full names are listed in Table 1, while Figure 7 shows their distribution.
- Dataset construction: Slight variations among fine-grained mode frequencies arise from injecting failures into successfully completed trajectories and judging consistency with the target mode.The construction process therefore contributes to the observed distribution.
C CASE STUDY OF WHO&WHEN DATASET
The Who&When case study shows that one trajectory can contain several failures, while the annotated mistake may identify an earlier detectable issue rather than the failure most responsible for the eventual outcome.
- Multiple coexisting failures: Who&When traces may contain multiple errors with different types and severities, so the annotated mistake step is not necessarily the most causally critical failure.This creates a distinction between earliest detectability and downstream impact.
- Early information insufficiency: In the example, Step 4 retrieves only a search-results page without structured information, representing information insufficiency but not inherently blocking task completion.The step remains a plausible intermediate exploration step despite being the annotated ground-truth mistake.
- Later behavioral stagnation: Later repeated clicks with identical viewports form a stagnation loop that blocks progress even after the orchestrator issues refined instructions.The system explicitly detects this behavior with is_in_loop: true.
- System-level interruption: A ResponsibleAI content-filtering violation causes a BadRequestError during orchestration, halting execution before successful completion or reasoning convergence.The interruption occurs during the orchestrator’s model-client call for ledger updates.
- Localization implication: The case indicates that effective localization must consider downstream impact on task completion, not only the first erroneous step.The annotated early issue is less decisive than the later stagnation and interruption for the final outcome.