Ying Chang, Jiahang Xu, Xuan Feng, Chenyuan Yang, Peng Cheng, Yuqing Yang
5 min
As compound agent systems become more complex, they generate massive, noisy execution traces that are difficult to use for automated optimization. Existing methods often struggle with a context-noise trade-off: either including too much irrelevant information, which leads to spurious correlations, or truncating traces, which discards the long-range causal dependencies necessary to identify why a failure occurred. This paper asks: how can we effectively distill these noisy, heterogeneous logs into high-quality diagnostic signals to improve agent policies?
STRACE (Structural Trajectory Analysis and Causal Extraction) treats execution logs as structured causal graphs rather than linear text. The framework operates in four phases:
By shifting the focus from repairing downstream symptoms to addressing upstream root causes, STRACE enables more precise and stable agent evolution. In empirical evaluations, including the challenging VeruSAGE-Bench formal verification task, STRACE significantly outperformed standard context-filtering and prompt-optimization baselines, delivering a 16% absolute improvement in success rates. This demonstrates that structural awareness is critical for scaling the optimization of complex, long-horizon agent systems.
The optimization of long-horizon agents increasingly relies on reflection-based mechanisms, where a large language model (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 .
Alex: But if the system is that aggressive about cutting out noise, doesn't it risk throwing away something important?
Sam: That's the right concern to raise. The dependency map is what prevents that. A step only gets kept if it can be shown to have directly changed the data or controlled which path the program took. If a step didn't do either of those things, it's excluded. So the pruning isn't arbitrary—it's governed by the causal structure of the code itself.
Alex: So it's like a teacher who, instead of handing you the whole textbook, highlights only the three sentences that actually explain why you got the answer wrong.
Sam: That's exactly it. And those clean, precise slices of history are then used to update the agent's behavior more broadly—not just to fix one specific bug, but to teach it a better way to reason about that class of problem entirely.
Alex: How does that broader update actually work? Is it just rewriting a rule somewhere?
Sam: It's more like changing a habit than rewriting a rule. The system uses those causal slices to perform what the paper calls Reflection-based Optimization. Instead of patching the specific line of code that failed, it adjusts the agent's underlying decision-making policy—the set of principles it uses to choose actions. So the next time it faces a similar situation, it reasons differently from the start, rather than making the same mistake and catching it at the end.
Alex: That's a meaningful distinction. It's moving from reactive patching to something closer to genuine learning.
Sam: It is. Though it's worth being clear about the limits. STRACE isn't a general-purpose solution. It requires what the paper calls system-level visibility—the agent needs access to the codebase, the configuration files, and the testing environment. It has to be able to see the internal structure in order to build that dependency map in the first place.
Alex: So if the internal components are hidden—if the hood is welded shut, so to speak—this approach can't work.
Sam: Correct. But for complex software projects where that visibility exists, the approach is well-suited. It moves us away from guessing why a program failed and toward a methodical, evidence-based diagnosis. The paper suggests this points toward a future of more self-sufficient software systems—ones that don't just crash and wait for a developer to intervene, but can perform their own root-cause analysis and keep running.
Alex: That's a significant shift in how we think about building and maintaining software. It's not just about writing good code anymore—it's about building systems that can identify and correct their own reasoning errors over time.
Sam: That's the direction the research points. By turning noisy, long-horizon failure logs into precise, targeted updates, STRACE isn't just helping agents fix mistakes—it's giving them a more reliable way to reason. Whether that scales to the full complexity of real-world systems is still an open question, but it's a meaningful step in that direction.
Alex: It's been a genuinely interesting look at how the field is thinking about agent reliability. Thanks for walking us through it, Sam.
Sam: My pleasure. Thanks for listening to ResearchPod.