Source-linked AI summary
AgentFold: Long-Horizon Web Agents with Proactive Context Management
Rui Ye, Zhongwang Zhang, Kuan Li, Huifeng Yin, Zhengwei Tao, Yida Zhao, Liangcai Su, Liwen Zhang, Zile Qiao, Xinyu Wang, Pengjun Xie, Fei Huang, Siheng Chen, Jingren Zhou, Yong Jiang
TL;DR
Long-horizon web agents must balance comprehensive and concise context, as raw histories accumulate noise while repeated full-history summaries risk losing details. AgentFold proactively folds its context at multiple scales, and AgentFold-30B-A3B establishes open-source state-of-the-art performance, scoring 36.2% on BrowseComp versus 30.0% for DeepSeek-V3.1-671B.
Problem
Long-horizon web agents need to balance context comprehensiveness and concision, but append-only ReAct histories accumulate noisy data while repeated full-history summaries risk irreversible information loss.
Source: §1 · p. 2, §3.5 · p. 7Method
AgentFold proactively folds its context at multiple scales, using granular condensation to preserve fine details and deep consolidation to abstract away prior summaries and concluded sub-tasks.
Source: §1 · p. 2, §3.5 · p. 7Results
AgentFold-30B-A3B establishes state-of-the-art performance for open-source agents, scoring 36.2% on BrowseComp versus 30.0% for DeepSeek-V3.1-671B.
Source: §1 · p. 3, §4.1 · p. 8Takeaways & Limitations
The findings show a 30B open-source agent can compete with substantially larger systems on information-seeking benchmarks.
Source: §1 · p. 3The study demonstrates AgentFold with straightforward supervised fine-tuning, leaving reinforcement learning to explore autonomous folding-policy discovery as future work.
Source: §5 · p. 11
Abstract
from arXiv · showhide
LLM-based web agents show immense promise for information seeking, yet their effectiveness on long-horizon tasks is hindered by a fundamental trade-off in context management. Prevailing ReAct-based agents suffer from context saturation as they accumulate noisy, raw histories, while methods that fixedly summarize the full history at each step risk the irreversible loss of critical details. Addressing these, we introduce AgentFold, a novel agent paradigm centered on proactive context management, inspired by the human cognitive process of retrospective consolidation. AgentFold treats its context as a dynamic cognitive workspace to be actively sculpted, rather than a passive log to be filled. At each step, it learns to execute a `folding' operation, which manages its historical trajectory at multiple scales: it can perform granular condensations to preserve vital, fine-grained details, or deep consolidations to abstract away entire multi-step sub-tasks. The results on prominent benchmarks are striking: with simple supervised fine-tuning (without continual pre-training or RL), our AgentFold-30B-A3B agent achieves 36.2% on BrowseComp and 47.3% on BrowseComp-ZH. Notably, this performance not only surpasses or matches open-source models of a dramatically larger scale, such as the DeepSeek-V3.1-671B-A37B, but also surpasses leading proprietary agents like OpenAI's o4-mini.
1 Introduction
Long-horizon web agents face a trade-off between retaining noisy interaction histories and risking irreversible loss through repeated summarization. AgentFold addresses this by proactively folding context at multiple scales, treating it as a workspace to manage rather than a log to fill.
1 Introduction
- ReAct-based agents preserve full histories but accumulate noisy web data, while repeated full-history summarization risks prematurely and irreversibly losing crucial details (Yao et al., 2023; Wu et al., 2025; Li et al., 2025b; Zhou et al., 2025b; Yu et al., 2025).The paper identifies this balance between context comprehensiveness and conciseness as a key challenge for long-horizon tasks (Wei et al., 2025; Wong et al., 2025).Source: §1 · p. 2
- AgentFold’s design draws on retrospective consolidation: a mental scratchpad discards irrelevant steps, distills findings, and abstracts insights at critical points.The paper proposes this dynamic look-back process as important for sustained long-horizon reasoning and exploration.Source: §1 · p. 2
- AgentFold jointly produces a folding directive and tool call, either condensing the latest interaction into a summary or consolidating it with prior summaries into a coarser abstraction.Deep consolidation can package a completed sub-investigation into its conclusion while retracting the specific entries it replaces.Source: §1 · p. 2
- Fold-Generator automatically creates training trajectories that combine situational actions with strategic context curation, using rejection sampling before fine-tuning open-source LLMs.The paper motivates this pipeline by noting that the required structured, multi-part trajectories were not already available as a dataset.Source: §1 · p. 2
- 36.2% on BrowseComp, 47.3% on BrowseComp-ZH, 62.1% on WideSearch, and 67.0% on GAIA: AgentFold-30B-A3B surpasses OpenAI’s o4-mini and matches or surpasses GLM-4.5-355B-A32B and DeepSeek-V3.1-671B-A37B.The model is trained with supervised fine-tuning on Qwen3-30B-A3B.Source: §1 · p. 3
2 Related Works
Related work identifies context saturation in ReAct-based web agents and distinguishes external context augmentation from managing context generated within a task. AgentFold targets the latter with selective, multi-scale folding of interactions over long horizons.
Web Agents
- ReAct-based web agents use iterative reasoning-action-observation loops, but append-only context can cause saturation on long-horizon tasks as critical signals become buried in noise.Examples include agents focused on dataset construction and test-time scaling.Source: §2 · p. 3
Context Management
- External context augmentation adds knowledge such as user profiles or past conversations, while intra-task context curation manages task-generated context for relevance and efficiency.AgentFold pursues intra-task curation.Source: §2 · p. 3
- MEM1 (Zhou et al., 2025b) and MemAgent (Yu et al., 2025) compress full histories step by step and were primarily evaluated on simpler, retrieval-focused tasks like HotpotQA (Yang et al., 2018).AgentFold instead retrospectively evaluates and selectively folds multi-step interactions at different scales, avoiding rigid step-wise compression for complex, long-horizon tasks.Source: §2 · p. 3
3 AgentFold: Web Agent with Proactive Context Folding
AgentFold treats context as a dynamic workspace that the agent proactively sculpts, using multi-scale folding to preserve useful detail while reducing noise from completed subtasks. Its design makes context curation part of the reasoning process rather than a passive log of interactions.
3.1 Overview
- AgentFold repeats a perceive–reason–fold–act cycle until it has enough information to answer, omitting the folding directive on the initial step because no prior history exists.The folding directive updates historical summaries, while the explanation, action, and resulting observation form the next latest interaction.Source: §3.1 · p. 4
3.2 AgentFold’s Context: Multi-Scale State Summaries, Latest Interaction
- AgentFold’s context combines the invariant question and available tools with multi-scale summaries as long-term memory and a complete latest interaction as high-fidelity working memory.Summaries retain past steps at different levels of detail, while the latest interaction records the explanation, tool call, and resulting observation, balancing historical concision with immediate situational awareness.Source: §3.2 · pp. 4–5
3.3 AgentFold’s Response: Thinking, Folding, Explanation, Action
- At each step, AgentFold jointly plans an action and issues a folding directive, using granular condensation for one latest step or deep consolidation to merge a completed multi-step subtask.The response also includes thinking and an explanation; folding and action planning inform one another as the agent curates its history and selects what to do next.Source: §3.3 · pp. 5–6
3.4 AgentFold’s Training: Data Trajectory Collection
- Fold-Generator uses the WebSailor question set (Li et al., 2025a) and rejection sampling to collect valid structured trajectories, which are used to train AgentFold with supervised fine-tuning.The filtering discards malformed steps and trajectories with too many environmental errors; the paper says SFT internalizes folding and makes inference more efficient than the general-purpose data-collection models.Source: §3.4 · pp. 6–7
3.5 Discussions
- AgentFold adapts folding to preserve potentially vital details or prune concluded sub-investigations, delaying consolidation until a subtask’s outcome is clear.The paper illustrates repeated full-history summarization with a hypothetical 1% detail-loss chance per re-summary: a step-1 finding has 36.6% survival by step 100 and 0.66% by step 500; append-only ReAct, meanwhile, accumulates context toward saturation.Source: §3.5 · p. 7
4 Experiments
AgentFold achieves strong benchmark results while keeping context growth controlled over long interactions. The experiments report competitive performance, substantial context savings versus ReAct, and continued scaling to hundreds of turns.
4.1 Results and Analysis
- AgentFold scores 36.2% on BrowseComp versus DeepSeek-V3.1-671B-A37B’s 30.0%, and 62.1% overall on WideSearch, surpassing all proprietary agents.The authors also report a new state of the art among open-source agents and high competitiveness with leading proprietary systems.Source: Table 1 · p. 8, §4.1 · p. 8
- Across 200 BrowseComp trajectories, average context grows sub-linearly from approximately 3.5k to 7k tokens over 100 turns, while over 20% of tasks hit the forced limit.At termination, context is approximately 7k tokens, a minor fraction of the model’s 128k capacity.Source: §4.1 · pp. 8–9, Figure 3 · p. 9
- AgentFold’s block count grows sub-linearly versus ReAct’s linear growth; Deep Consolidation merges past steps, and its structural-efficiency advantage grows on longer tasks.The analysis counts each Multi-Scale State Summary entry plus the latest interaction as a block.Source: §4.1 · p. 9
- Across the same trajectories, average context lengths show ReAct’s context growing uncontrolled and near-linearly as tasks progress, while AgentFold’s remains remarkably flat and controlled through proactive folding.Source: §4.1 · p. 9
- On BrowseComp, AgentFold consistently outperforms the 355B GLM-4.5 baseline at comparable turn limits and improves through 256 turns, while GLM-4.5 saturates beyond 64.The experiment varies the interaction limit up to 256 turns.Source: §4.1 · p. 10, Figure 4 · p. 10
- With a 500-turn limit, AgentFold’s context mostly stays below 20k tokens and does not grow monotonically, as deep consolidation can compress failed inquiries before a new strategy.The authors attribute this behavior to recognizing dead ends, abstracting away the failed sub-trajectory, and pivoting to a new strategy.Source: §4.1 · p. 10
- In a case study, AgentFold folds an unsuccessful 11-step search into one conclusion, preserves the lesson that the approach is unworkable, and plans a new investigation.The example shows the agent recognizing steps 6–16 as a dead end and using the consolidated insight to choose subsequent search queries.Source: §4.1 · pp. 10–11, Figure 5 · p. 10
5 Conclusions
AgentFold proactively manages context through multi-scale folding, balancing fine-grained detail preservation with abstraction of irrelevant history. AgentFold-30B-A3B outperforms open-source models over 20 times its size and is highly competitive with OpenAI’s o4-mini.
Conclusions
- AgentFold-30B-A3B establishes a new state of the art for open-source agents, outperforming models over 20 times its size and proving highly competitive with OpenAI’s o4-mini.Its context efficiency supports hundreds of interaction steps within a manageable context.Source: §5 · p. 11
- AgentFold uses a proactive fold operation to preserve fine-grained details through Granular Condensation and abstract irrelevant history through Deep Consolidation.The paradigm is presented as resolving the trade-off between context saturation in append-only agents such as ReAct and information loss from uniform summarization.Source: §5 · p. 11
- AgentFold’s context efficiency enables long-horizon problem-solving across hundreds of interaction steps within a manageable context.Source: §5 · p. 11
What’s next
- The work uses straightforward SFT without extensive optimization, with reinforcement learning proposed as a next step for discovering folding policies that optimize task success.Source: §5 · p. 11
A Appendix · A.1 Case Study
Appendix A.1 presents two case studies through tables and step-specific context and response figures; the supplied passages identify these materials but do not describe their substantive findings.
A.1 Case Study
- Two case studies are documented with tables and figures, with case 1 in Table 2, Figures 6–7 and case 2 in Table 3, Figures 8–9.The passage identifies the case-study materials but does not state their findings.Source: §A.1 · p. 15
- Case study 1 is documented in Table 2 and its continuation pages.The supplied captions identify the case study but provide no table contents.Source: Table 2 · pp. 15–18
- Case study 2 is documented in Table 3 and its continuation pages.The supplied captions identify the case study but provide no table contents.Source: Table 3 · pp. 18–22
- A listed trajectory point is Turn 38, annotated as compressed steps 0–34, compressed step 35, and step 36.Source: §A.1 · p. 20
- Figures 6 and 7 show case study 1’s context and response at step 17, respectively.Source: Figure 6 · p. 23, Figure 7 · p. 24
- Figures 8 and 9 show case study 2’s context and response at step 45, respectively.Source: Figure 8 · p. 25, Figure 9 · p. 26
Related papers
This paper cites
Cited by
- FlexA-Mem: Budget-Adaptive Agentic Memory for LLM Agents2026
- Trial by Trace: Benchmarking AI Agent Harnesses for Reliability and Failure Attribution2026
- Benchmarks Are Surprisingly Compaction-Friendly2026
- When to Forget: Risk-Controlled Context Adaptation for Long-Horizon Agents2026
- Pack Light, CarryOn: Building Object-Oriented Context for Long-Horizon Agents2026
- Scaling Agentic Data for Long-Horizon Terminal Intelligence2026