As long-horizon agents increasingly rely on multi-step tool interactions to accomplish complex tasks, their execution trajectories continuously accumulate structured outputs and intermediate artifacts, leading to growing context overhead. Existing compression methods primarily rely on text importance or fixed truncation rules, often overlooking cross-step dependencies within workflows and potentially discarding critical information required for subsequent task execution. To address this challenge, we propose WAAC, a workflow-aware framework for agent trajectory compression. WAAC structurally models successful historical trajectories to extract reusable workflow compression experience and incorporates online backward dependency analysis to dynamically identify information retention requirements. By combining current dependency constraints with historical experience, WAAC selects appropriate compression strategies for different types of historical information. Experiments on PinchBench and Odysseys demonstrate that WAAC achieves an overall score of 87.6 and a perfect completion rate of 19.0%, respectively, while reducing execution costs by 19.7% and 29.1% compared with the strongest baseline methods. These results demonstrate the effectiveness of workflow-aware trajectory compression in improving task performance and cost efficiency for long-horizon agents. Code and resources are available at https://anonymous.4open.science/r/waac-6527/.
Figures & tables
Figure 1. Motivating example. (a) Accumulating browsing history. (b) Loss of task-critical fields under compression. (c) WAAC assigns field-specific representations using workflow dependencies and historical policies. (a) An uncompressed agent trajectory accumulates interaction history across multiple tool-assisted tasks, increasing context overhead and retaining redundant information. (b) Traditional compression may discard information required by subsequent operations when dependencies between trajectory nodes are not explicitly considered. (c) WAAC combines historical workflow knowledge with dependency-aware compression to apply different preservation policies, including EXACT, POINTER, SUMMARY, and DROP, to individual fields. This enables the agent to reduce redundant context while retaining information needed for subsequent execution.
Figure 2. Overview of WAAC. Offline processing converts verified development trajectories into canonical workflow fragments and field-level policy records. Before each online model invocation, WAAC derives requirements from outstanding obligations, retrieves compatible historical policies, and combines them through a conservative join. The resulting projection changes the model-visible history while retaining original events and artifacts in runtime storage. The Framewrok provides a detailed explanation of the WAAC architecture’s processing of converting traces into DAGs, the management of the History trajectory library, the analysis and computation of online dependencies, and the final strategy fusion selection.
Method
Overall
Performance by Category ↑
Input(M)
Output(M)
Time (s) ↓
Prod
Res
Write
Code
Anal
CSV
Log
Meet
Mem
Skill
Integ
Vanilla
72.6
66.2
44.4
71.0
72.4
66.6
77.0
82.8
75.6
92.6
54.4
88.1
9.496
0.403
15,705
Keep-Last-N
78.0
75.4
70.0
79.4
88.0
78.6
74.3
77.5
82.9
87.5
60.8
85.8
9.312
0.353
12,950
LLMLingua-2
84.3
87.0
48.1
87.2
87.6
82.7
91.9
90.4
88.3
86.2
67.2
78.9
9.037
0.385
15,036
TokenSkip
79.2
88.1
62.2
87.1
82.3
81.2
76.4
81.5
82.4
85.4
68.6
74.2
9.458
0.278
15,659
Summary
81.4
73.3
62.6
87.7
87.1
83.0
81.4
90.1
81.6
87.5
67.4
68.4
9.220
0.337
16,128
Table 1. Performance and token/time consumption of PinchBench.
Method
O-M2W Judge ↑
Rubrics (%) ↑
Avg. Steps ↓
Traj. Eff. ↑
Input(M)
Output(M)
Avg.
Perfect
Hard
Partial
Avg. Hit
Vanilla
12.0
31.0
7.5
1.8
22.0
1.9
75
0.42
75.25
4.501
Keep-Last-N
9.0
25.8
5.5
1.0
16.5
1.6
84
0.31
84.52
5.046
LLMLingua-2
8.6
23.5
4.5
0.7
14.1
1.4
91
0.27
91.27
5.462
TokenSkip
11.5
31.0
7.2
1.6
21.0
1.9
75
0.43
75.34
4.551
Summary
10.3
26.4
5.0
0.9
17.4
1.6
82
0.34
82.64
4.924
Table 2. Performance of different methods on the Odysseys task.
Variant
Overall ↑
Input (M) ↓
Output (M) ↓
Time (s) ↓
WAAC (Full)
87.6
7.174
0.285
13,155
w/o Offline
81.8 ( −5.8 )
7.882 ( +9.9% )
0.341 ( +19.6% )
13,773 ( +4.7% )
w/o Online
80.6 ( −7.0 )
7.643 ( +6.5% )
0.350 ( +22.8% )
14,634 ( +11.2% )
Table 3. Ablation study of WAAC on PinchBench and Odysseys.
Figure 3. Peak Limit Testing on Odysseys. Stress testing with maximum input token limits on the Odysseys dataset
Workflow Size
Metric
Methods
Vanilla
Keep-Last-N
LLMLingua-2
Summary
AgentFold
Mem0
WAAC
2
Acc. ↑
70.8
76.7
83.4
80.7
80.1
77.6
87.1
Rel. ↓
100
98 (-2)
102 (+2)
101 (+1)
94 (-6)
99 (-1)
78 (-22)
4
Acc. ↑
66.1
72.4
81.3
78.1
78.7
75.2
86.2
Rel. ↓
100
92 (-8)
105 (+5)
103 (+3)
91 (-9)
102 (+2)
72 (-28)
8
Acc. ↑
57.6
65.5
77.2
74.3
75.7
71.8
84.0
Table 4. Continuous Workflow Testing on PinchBench. Acc.=Accuracy, Rel.=Method Total Token / Vanilla Total Token ×100 .
Figure 4. Field-level retention decisions and browser-state requirements in a kitchen-setup workflow. Recipe and cookware facts receive EXACT, video guidance receives SUMMARY, recoverable page observations receive POINTER, and redundant search text is eligible for DROP. Exact tab identifiers support browser-state checks, while live tabs remain in runtime state.