Papers
Topics
Authors
Recent
Search
2000 character limit reached

From Noisy Traces to Root Causes: Structural Trajectory Analysis and Causal Extraction for Agent Optimization

Published 8 Jul 2026 in cs.CL | (2607.07702v1)

Abstract: The optimization of long-horizon agents increasingly relies on reflection-based mechanisms, where a LLM acts as an optimizer to diagnose agent failures and improve agent policies. However, real execution traces are difficult to use directly for optimization: large trace collections are often redundant and heterogeneous, making optimization inefficient and prone to overfitting to low-value failures; meanwhile, each individual trajectory also contains many irrelevant steps, while naive context reduction methods such as truncation or sliding windows can discard causally important evidence and produce misleading optimization signals. To resolve this dilemma, we introduce STRACE (Structural TRajectory Analysis and Causal Extraction), a framework that constructs high signal-noise optimization contexts for more precise and effective optimization. At the batch level, STRACE mines failure patterns to filter redundant traces and retain representative failures; within each selected trace, it performs causal localization over a textual dependency graph to remove non-causal steps and identify the true root-cause module for optimization. Empirical results demonstrate that STRACE significantly outperforms standard context-filtering baselines. Notably, on a challenging formal verification task (VeruSAGE-Bench), it successfully optimizes human-expert designed agents, delivering $1.4\times$ success-rate improvement (42.5% to 58.5%). The code is available at https://github.com/moomight/STRACE .

Summary

  • The paper introduces STRACE, which uses structural modeling and causal extraction to isolate root causes from noisy long-horizon agent traces.
  • The methodology combines execution dependency graphs, failure pattern mining, and backward causal slicing to balance context noise and ensure effective causal attribution.
  • Empirical evaluation demonstrates a 1.4ร— improvement in success rates and reduced optimization costs compared to traditional full-trace and truncation methods.

STRACE: Structural Trajectory Analysis and Causal Extraction for Long-Horizon Agent Optimization

Context and Motivation

Reflection-based optimization frameworks leveraging LLMs have become central to improving long-horizon agentic workflows. However, as agents grow in execution horizon and complexity, their trace data becomes highly redundant, heterogeneous, and noisy. Directly optimizing over large collections of execution traces introduces two core inefficiencies: (1) computational intractability and overfitting due to redundancy, and (2) poor causal attribution from the inclusion of irrelevant or temporally distant context, which obscures root causes and dilutes optimization signal.

Traditional trade-offs in context management (full-trace vs. truncation) typically either drown the optimizer in noise or amputate critical long-range dependencies. These limitations fundamentally restrict the precision and efficacy of prompt or policy updates in modular, multi-step agent systems. Figure 1

Figure 1: Full-trajectory and truncation baselines fail to balance SNR and causal coverage, while STRACE distills a targeted causal slice for effective optimization.

STRACE Framework Architecture

The STRACE framework systematically addresses the context-noise dilemma via a decoupled analysis pipeline that transforms raw trajectory data into optimized, root-cause-targeted updates. The pipeline is organized into four phases:

  1. Structural Modeling: Constructs a textual Execution Dependency Graph (EDG) for the agent, capturing both data and control dependencies between functional modules.
  2. Failure Pattern Mining & Trace Filtering: Aggregates heterogeneous trace logs and summarizes them into statistical and structural failure patterns. Representative traces are selected via clustering on severity and path-based diversity.
  3. Causal Localization: For each selected trace, backward slicing via the EDG distills the minimal causal slice and identifies the true root cause node, differentiating it from manifestation points of error.
  4. Inductive Policy Optimization: Synthesizes and injects generalized, reusable heuristics into the prompt policies of localized root-cause modules, enabling persistent, targeted improvement. Figure 2

    Figure 2: STRACEโ€™s four-phase process: structural graph modeling, failure summarization/filtering, causal localization via slicing, and targeted policy repair.

Failure Pattern Mining and Trace Selection

STRACE's filtering phase applies deterministic parsing to convert heterogeneous agent traces into structured records, extracting both global outcomes and per-node module statuses. The failure summarization maps each trace corpus along: (i) Statistical Severityโ€”the conditional probability of global failure given a node error; and (ii) Structural Path Patternsโ€”invocation sequences revealing systemic patterns such as dead ends and self-loops.

Trace selection proceeds via clustering on these diagnostics, ensuring high failure-mode coverage and minimizing redundancy. This approach is robust to missing explicit node errors, as it can fallback to structure-only clustering. Figure 3

Figure 4: Failure Summarization Map exposes both statistical bottlenecks and path-based anomalies for summary-driven trace filtering.

Causal Localization: From Symptoms to Root Causes

Causal localization is grounded in the notion that error manifestation and logical origin are typically non-coincident in modular agentic workflows. STRACE employs dependency-guided backward slicing to extract the "causal slice"โ€”the minimal subtrajectory involved in the propagation of corrupted contextโ€”then performs causal deduction to assign blame to upstream logic defects rather than symptom nodes. This is formalized as the distinction between the manifestation node (vmv_m) and the root-cause node (vrv_r). Figure 5

Figure 5: Causal localization re-attributes failures from visible symptom nodes to true upstream causes in execution graph structure.

Case analyses demonstrate that causal localization frequently remaps errors away from downstream repair modules to high-leverage control or routing modules responsible for upstream misdecisions. This mechanism is critical for breaking recurrent failure loops and providing focused repair opportunities.

Inductive Policy Optimization

Localized, cause-attributed failure episodes are aggregated, and LLM-based abstraction extracts higher-order rules that are synthesized into persistent prompt augmentations for affected modules. The core design principle is inductivity: transforming episodic defect evidence into generalized behavioral guidelines with transferability across varying execution contexts, resisting overfitting to single manifest errors.

Prompt updates are injected only into the prompts of directly responsible modules, ensuring surgical policy improvement with bounded intervention scope and no codebase modification.

Empirical Evaluation

STRACE is evaluated on HotpotQA (multi-hop QA), WebArena (web-based task completion), and VeruSAGE-Bench (Rust program verification). Across benchmarks, STRACE yields the highest observed performance, particularly on long-horizon or domain-intensive tasks. On VeruSAGE-Bench, STRACE delivers a 1.4ร— improvement in success rate over human-expert agents (42.5% โ†’ 58.5%) and outperforms the strongest prior automatic optimizer, GEPA, by 11.3% absolute.

Optimization cost analysis reveals that STRACE achieves the most favorable scaling trend versus context-budget-intensive baselines (e.g., TextGrad full-trace and GEPA with truncation), attributed to effective trace compression and context distillation. Figure 4

Figure 3: STRACE achieves superior success rates at lower optimization cost as the number of training cases increases.

Ablation studies confirm the necessity of structural modeling, filtering, and causal localization: removal of any component leads to significant performance and/or efficiency regression.

Theoretical and Practical Implications

STRACE demonstrates that modular, structural analysis of agent execution is critical for both effective and efficient neuro-symbolic agent optimization. By framing trace logs as causal graphs and balancing context length with causal coverage, STRACE enables granular, persistent repair signals without reliance on brute-force trajectory replay or coarse context truncation. The approach generalizes beyond black-box language modeling to settings where agent harnesses, skills, and tool-use behaviors are exposed, suggesting applicability to self-evolving agentic systems and harness-level evolution frameworks.

By dissecting failures at the structural and causal levels, STRACE points toward more robust solutions for temporal and structural credit assignmentโ€”core challenges in RL- and LLM-based agent optimizationโ€”opening avenues for more interpretable and controllable optimization workflows.

Future Directions

Potential future developments include:

  • Extension to black-box or low-visibility agent settings via learned or inferred structure graph priors.
  • Integration of active learning strategies for trace selection under limited context and intervention budgets.
  • Incorporation of learned causal inference mechanisms to robustly automate causal localization and slicing.
  • Application to dynamic, online agent self-evolution and lifelong learning under continual deployment.

Conclusion

STRACE offers a principled, structure-aware solution to the context-noise optimization trade-off in long-horizon LLM-agent workflows. Its combination of failure pattern mining, causal localization, and localized policy optimization enables significant gains in success rate and efficiency, surpassing both summary-based, retrieval, and full-trace prompt tuning paradigms. Empirical studies across domains validate the robustness and modularity of the approach, positioning STRACE as a scalable framework for granular, interpretable agent optimization in complex, multi-step AI systems.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 1 tweet with 0 likes about this paper.