StateGuard improves tracking validity for long data analysis workflows
StateGuard: Analytical-State Management with Validity-Aware Intervention for Long-Horizon Data Agents
Artificial Intelligence
Summary
Long data analysis tasks often involve many steps where earlier results affect later ones. Problems happen when old information becomes outdated but is still used, causing mistakes to spread. The authors created StateGuard to keep track of which parts of the analysis are still valid, by organizing data as connected states that can be checked and fixed. Their system learns to maintain and correct these states using special training methods, resulting in more reliable analysis over many steps.
What this means in practice
- •For data science teams: Manage complex analysis steps by automatically verifying and fixing intermediate results to reduce errors across lengthy workflows.
- •For business intelligence developers: Build smarter data agents that maintain accurate states over multi-stage queries, improving reliability of analytics tools.
Authors
Wenle Liao, Zhao Wang, Jingchao Zhang, Jiajie Jin, Yimeng Xu, Zhicheng Dou
Abstract
LLM-based agents have shown strong capabilities in automated data analysis and are increasingly moving toward long-horizon, multi-stage analytical workflows. However, as the analytical process evolves, constraints, variables, and conclusions remain implicitly embedded in interaction histories, making it difficult for agents to track which analytical artifacts remain valid over increasingly long horizons and changing dependencies. Consequently, stale artifacts may be silently inherited, propagating errors to downstream stages. To address this challenge, we propose StateGuard, an analytical-state validity management framework for long-horizon data agents. StateGuard externalizes evolving analytical progress into a state graph containing constraints, versioned variables, intermediate conclusions, and cross-state relations, treating each state as an executable, verifiable, and traceable object rather than textual memory alone. StateGuard maintains state validity through evidence-grounded verification and hierarchical intervention. To equip StateGuard with these capabilities, we first introduce Manager-Oriented Counterfactual Supervision, which constructs 3K state-centric trajectories through counterfactual runtime synthesis to fine-tune StateGuard for state maintenance, verification, and repair. We then apply Validity-Guided Policy Optimization, using runtime validity evidence to provide fine-grained learning signals for protocol correctness, state grounding, and intervention quality. Experiments on three diverse long-horizon data-analysis benchmarks show that StateGuard consistently improves data-agent performance while reducing dependency-induced downstream error propagation, demonstrating the advantages of explicit analytical-state management for reliable long-horizon data analysis.