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
cs.AI
2026-09-02
AgentScope graphs traces and checks neural invariants. On 303-trace AgentErrata: ~30% exact-step hit and ~44% type accuracy, vs 2–4% and 18–21% for whole-trace LLM judges.
LLM agents fail inside long traces. A bad reasoning step, a mismatched tool call, or a missed stop can cascade for dozens of steps before the task actually dies. Reading those traces by hand does not scale.
Classic software debugging looks at code and symbolic execution. That toolkit does not see "this step used the wrong context." Feeding the whole trace to an LLM-as-judge is not a fix either. GPT-5.1 reaches only 18.15% failure-type accuracy on the authors' attribution set. Models mix symptoms with causes and lose their place in long context. Diagnosis has to name a step and a type.
Tsinghua and Microsoft Research build a graph first, then let the LLM judge only inside that graph.
The trace becomes a Reasoning-Action Graph (ReAG): a DAG whose nodes are steps, each with a role, an action payload, and an Intermediate Semantic Representation. The ISR stores three fields, intent and context, reasoning and action, and signal and validation, so later checks do not have to reread a bloated raw log. Edges record control or data dependence. API calls, tool I/O, and unstructured logs can all be ingested.
On that graph they check neural invariants. Each of ten failure modes is a "this should not happen" condition. Action Mismatch is the clean example: an action node must align with the previous reasoning node's intent, pick a reasonable tool, and move the task forward. The aligned() check is an LLM binary classifier with a structured prompt. These are neural conditions, not Hoare-style predicates a theorem prover could discharge. The ten modes sit in three buckets: reasoning (Wrong Context, Instruction Unfollowing, Insufficient Context, Context Miss), control-flow (Termination Miss, Premature Termination, Step Loop), and action (Action Mismatch, Invocation Issue, Execution Failure).
The pipeline has three stages on purpose. Build and annotate the graph. Run per-mode invariant checks and keep every candidate. Then pick the decisive error: the failure that best explains the final degraded outcome, not the earliest anomaly. Detection and root-cause selection are separate, so a later user could ask for the first break, the last recoverable step, or the commit that sealed the loss.
Two benchmarks. Who&When is public: 184 human-annotated traces, 126 algorithm-generated and 58 hand-crafted, labeled with a failure step only. AgentErrata is new: 303 traces built by injecting taxonomy-guided faults into successful runs of OpenManus, OWL, and Mini SWE-Agent on BrowseComp, SWE-Bench Lite, and WebArena. Both step and type are labeled. The three buckets land near 36% reasoning, 31% control-flow, 36% action.
Exact-step localization (tolerance 0, no gold solution):
| Set / backbone | AgentScope | Step-by-step | All-at-once |
| AgentErrata / GPT-4o | 30.03% | 8.91% | 2.09% |
| AgentErrata / GPT-5.1 | 31.35% | 1.32% | 3.30% |
| AgentErrata / DeepSeek-V3.2 | 34.98% | 17.82% | 0.66% |
| Who&When algo / GPT-4o | 28.57% | 15.08% | 16.67% |
| Who&When hand / GPT-4o | 22.41% | 17.24% | 5.17% |
Failure-type accuracy on AgentErrata with GPT-5.1 is 45.87% for AgentScope versus 18.15% for a whole-trace LLM-as-judge. With a ±3-step window, GPT-5.1 AgentScope reaches 54.13% against 13.20% and 18.81% for the two baselines.
Swap in GPT-5.1 on Who&When and the gap shrinks: AgentScope and Step-by-step both hit 25.40% on the algorithm-generated split. Who&When marks the earliest detectable mistake. AgentScope picks the step that most explains the final failure. Those are different targets.
A stronger base model is not a debugger. GPT-5.1 on the step-by-step baseline falls to 1.32% exact-step accuracy on AgentErrata, worse than GPT-4o's 8.91%. The gain comes from turning free-form judging into per-mode checks on an aligned graph.
The practical use is offline postmortems of long traces, when you need both "which step" and "which class." Runtime is not cheap. Across 20 profiled traces, a 4-step run takes about 25 seconds and 7 LLM calls; a 120-step run takes about 750 seconds and 242 calls. Step Loop is the expensive check, about 85 seconds, because it compares windows pairwise. The authors note that cutting call count beats shortening prompts, and the checks can run in parallel.
Name collision: Alibaba's open-source agent framework is also called AgentScope. This paper is a Microsoft Research diagnosis toolchain, not that project.
AgentErrata injects faults into successful traces. That is not the distribution of natural failures, and an LLM gate on "is this trajectory a fit for this fault" adds its own bias, which the appendix admits. Absolute numbers stay modest: roughly 30% exact step, 44% type. That is far from a production debugger.
The invariant checkers are still LLM binary classifiers. Structure narrows the search; it does not turn correctness into a proof. The Who&When mismatch shows that "localization accuracy" depends on whether root cause means first break or fatal break; other selection policies are left as future work. There is no standalone Limitations section. Runtime, label definitions, and synthetic faults all need a discount.