Source-linked AI summary

AgentSwing: Adaptive Parallel Context Management Routing for Long-Horizon Web Agents

Zhaopeng Feng, Liangcai Su, Zhen Zhang, Xinyu Wang, Xiaotian Zhang, Xiaobin Wang, Runnan Fang, Qi Zhang, Baixuan Li, Shihao Cai, Rui Ye, Hui Chen, Jiang Yong, Joey Tianyi Zhou, Chenxiong Qian, Pengjun Xie, Bryan Hooi, Zuozhu Liu, Jingren Zhou

arXiv:2603.27490v1cs.CLcs.AIcs.MA

TL;DR

Long-horizon agents face a tension between finite context capacity and extended exploration, while static context-management strategies cannot adapt to changing trajectory quality. AgentSwing introduces a probabilistic efficiency–precision framework and adaptively routes among parallel context-managed branches. Across benchmarks and backbones, it consistently improves performance over static baselines, often matching or exceeding them with up to 3× fewer interaction turns and achieving a higher performance ceiling.

  • Problem

    Long-horizon agents must explore extensively under finite context capacity, but fixed context-management strategies cannot adapt as accumulated context quality changes.

  • Method

    AgentSwing decomposes success into search efficiency and terminal precision, then uses parallel context-managed branches with lookahead routing to select continuations adaptively.

  • Results

    AgentSwing consistently improves long-horizon performance over static context-management baselines across multiple benchmarks and backbones, often matching or exceeding methods requiring up to 3× more interaction turns.

  • Takeaways & Limitations

    The probabilistic framework provides a unified lens for analyzing context-management behavior and designing adaptive strategies for long-horizon agents.

  • Takeaways & Limitations

    The current router is performed by the agent model itself and may be improved by a dedicated router, verifier, or trajectory evaluator with better foresight.

Abstract

from arXiv · show

As large language models (LLMs) evolve into autonomous agents for long-horizon information-seeking, managing finite context capacity has become a critical bottleneck. Existing context management methods typically commit to a single fixed strategy throughout the entire trajectory. Such static designs may work well in some states, but they cannot adapt as the usefulness and reliability of the accumulated context evolve during long-horizon search. To formalize this challenge, we introduce a probabilistic framework that characterizes long-horizon success through two complementary dimensions: search efficiency and terminal precision. Building on this perspective, we propose AgentSwing, a state-aware adaptive parallel context management routing framework. At each trigger point, AgentSwing expands multiple context-managed branches in parallel and uses lookahead routing to select the most promising continuation. Experiments across diverse benchmarks and agent backbones show that AgentSwing consistently outperforms strong static context management methods, often matching or exceeding their performance with up to $3\times$ fewer interaction turns while also improving the ultimate performance ceiling of long-horizon web agents. Beyond the empirical gains, the proposed probabilistic framework provides a principled lens for analyzing and designing future context management strategies for long-horizon agents.

1 Introduction

Long-horizon web agents must balance finite context capacity against extended information-seeking, while existing fixed strategies cannot adapt to changing trajectory quality. AgentSwing addresses this with probabilistic analysis and adaptive parallel routing, achieving strong performance with fewer interaction turns.

  • Long-horizon information-seeking often requires tens or hundreds of steps of searching, verification, and backtracking before agents can answer.
  • Finite context capacity creates a bottleneck because agents may exhaust their workspace before completing an informative search.
  • Existing context-management methods repeatedly apply one fixed strategy, despite accumulated context quality changing throughout a trajectory.
  • The proposed framework decomposes long-horizon success into search efficiency and terminal precision, separating reaching a stopping point from answering correctly there.
  • AgentSwing expands multiple context-managed branches at trigger points and uses lookahead routing to select promising continuations.
  • AgentSwing consistently outperforms static methods, matching or exceeding strategies requiring up to 3× more interaction turns while raising the ultimate performance ceiling.

2 A Complementary Probabilistic View of Long-Horizon Web Agents

The paper decomposes long-horizon success into search efficiency and terminal precision, then uses this lens to compare context-management strategies. It shows how reset opportunities and adaptive routing balance these dimensions.

  • Search efficiency measures reaching a stopping point, while terminal precision measures correctness conditioned on reaching one.
  • Long-horizon success requires both reaching a stopping point within available resources and producing a correct final answer.
  • Pass@1 jointly reflects search efficiency and terminal precision rather than serving as a monolithic long-horizon indicator.
  • Discard-All vs. Baseline: Discard-All resets the accumulated trajectory after a context threshold, enabling multiple reset-based attempts under a fixed turn budget.
  • Discard-All vs. Baseline: Although each Discard-All attempt is less likely to finish, more reset opportunities can increase stopping-point chances while smaller contexts improve precision.
  • Strategy Comparison: All evaluated context-management strategies outperform the baseline in Pass@1, while AgentSwing reaches the strongest overall region through adaptive routing.

3 AgentSwing

AgentSwing manages context adaptively by applying multiple candidate strategies in parallel at trigger points and routing among their short-horizon continuations. It activates when context length crosses a predefined threshold and uses lookahead to select a continuation.

  • AgentSwing activates context management when the current context exceeds a predefined fraction of the model’s maximum context length.
  • Parallel Context Management: At each trigger point, it applies multiple candidate context management strategies to the same raw context in parallel.This produces alternative managed contexts and candidate continuations from one trajectory state.
  • Parallel Context Management: The candidate strategies include Keep-Last-N, Summary, and Discard-All.Keep-Last-N retains the latest N interaction tuples, Summary compresses the trajectory into (q, Sum), and Discard-All removes accumulated interaction history.
  • Lookahead Routing: After management, each branch continues for K additional turns before the agent model selects the most reasonable branch for subsequent exploration.The model evaluates candidate continuations together with the original raw context rather than selecting immediately after context management.

4 Experiments

Experiments evaluate AgentSwing across benchmarks, models, interaction budgets, aligned cases, routing ablations, lookahead depths, token costs, and a case study. Across these analyses, adaptive routing combines efficiency and precision advantages while maintaining strong performance without substantially larger overall cost.

  • Setup: AgentSwing is evaluated on BrowseComp, BrowseComp-ZH, and HLE with GPT-OSS-120B, DeepSeek-v3.2, and Tongyi-DR-30B-A3B.The evaluation uses sampled subsets for larger benchmarks, a 128k-token context limit, and a default maximum interaction budget of 400 turns.
  • Overall Performance: AgentSwing consistently outperforms the standard baseline and representative static context management strategies across benchmarks and agent backbones.It reaches 71.3 on BrowseComp-ZH and 44.4 on HLE with DeepSeek-v3.2.
  • Analysis of Context Management Strategies: Once interaction budgets are sufficiently large, all context management strategies surpass the baseline, while AgentSwing remains advantageous across the scaling curve.At small budgets, the baseline can retain stronger search efficiency, but AgentSwing outperforms it even under limited budgets.
  • Aligned Cases: Keep-Last-N and Summary usually provide stronger search efficiency η, whereas Discard-All provides the strongest terminal precision ρ; AgentSwing combines these strengths and achieves the highest overall Pass@1 on aligned cases.AgentSwing’s average turn counts remain close to efficiency-oriented strategies and substantially below Discard-All.
  • Ablation of the Lookahead Routing Mechanism: Random routing and routing without lookahead both underperform AgentSwing, showing that short-horizon evaluation of downstream consequences matters beyond maintaining multiple candidate branches.The ablation compares uniform random branch selection with parallel context management that removes rollout.
  • Lookahead Depth: Moderate lookahead is most effective, with k = 3 generally strongest; larger lookahead such as k = 5 may risk exceeding agent-model maximum length constraints.Compared with k = 1, k = 3 exposes richer future trajectory information.
  • Token Efficiency: AgentSwing’s additional token usage from lookahead remains modest, avoiding a substantially larger overall cost despite differing token-turn trade-offs among strategies.Keep-Last-N can accumulate more tokens at similar turn counts, while Discard-All tends to use fewer tokens but require more turns.
  • Case Study: In a DeepSeek-v3.2 case, lookahead selects Keep-Last-N because it preserves a recent clue chain that enables verification after competing branches follow misleading or broad-search continuations.The trigger state contains distractions from incorrect hypotheses and a newly surfaced local clue.

5 Related Work

Related work positions long-horizon web agents as autonomous systems for browsing, tool use, and deep information seeking. Existing context-management methods primarily curate context statically through reset, recent-turn retention, or summarization strategies.

  • Long-horizon web agents: Long-horizon web agents extend single-turn assistants with web browsing, tool use, and long-horizon information seeking.Prior academic and industry efforts also emphasize test-time scaling and long-horizon interaction design.
  • Context management for LLM agents: Prior context-management methods mainly use static intra-task curation, including Discard-All resets, Keep-Last-N recent-turn retention, and Summary-style context compaction.These strategies represent reset-based, retention-based, and compaction-based approaches.

6 Conclusion

The paper introduces a probabilistic lens separating search efficiency from terminal precision and proposes AgentSwing, which routes among parallel context-managed branches using lookahead. Experiments across benchmarks and backbones show consistent improvement over static context-management baselines.

  • Conclusion: The framework decomposes deep information-seeking success into search efficiency and terminal precision to analyze context-management behavior.These dimensions provide a unified view of how strategies affect long-horizon performance.
  • Conclusion: AgentSwing expands multiple context-management branches and dynamically selects among them through lookahead routing instead of using one static strategy.The approach is designed for long-horizon web agents.
  • Conclusion: Experiments across multiple benchmarks and backbones show that AgentSwing consistently improves long-horizon agent performance over static context-management baselines.The conclusion describes the framework as both effective and generalizable.

7 Limitations and Future Work

The work focuses on test-time context management as an external control mechanism, while identifying model-level competence and stronger routing as future directions.

  • The current routing mechanism is performed by the agent model itself, which may not be optimal.A dedicated router, verifier, or trajectory evaluator with better foresight may improve branch selection quality.
  • Future work could translate the framework’s principles into agents that are more efficient with smaller context budgets or more reliable on noisy long-horizon trajectories.

A Gains from Parallel Context Management Combinations

The experiments compare different candidate context management combinations within AgentSwing on BrowseComp using Tongyi-DR-30B-A3B.

  • Figure 8 compares different context management combinations within AgentSwing.The comparison uses Tongyi-DR-30B-A3B on BrowseComp.

B Analysis of Strategy Transitions under AgentSwing

AgentSwing’s strategy transitions are non-uniform, and preferred next strategies depend on the underlying backbone.

  • Strategy-transition probabilities under AgentSwing are non-uniform, indicating that routing behavior is not random.
  • DeepSeek-v3.2 and Tongyi-DR tend to favor Summary, whereas GPT-OSS-120B more often transitions to Discard-All.

C Case Study

The case studies examine main trajectories and lookahead branches under different context management strategies, including a GPT-OSS-120B trajectory where Discard-All helps recover from noisy exploration.

  • Mando case: Tables 4 and 5 summarize the main trajectory in the “Mando” case, while Table 6 reports lookahead continuations under different context management strategies.
  • Discard-All case: In a GPT-OSS-120B case, Discard-All is selected when trajectories contain substantial noise, repetition, and failed local exploration.
  • Discard-All case: Aggressively resetting accumulated context allows the agent to recover a cleaner search state and refocus on relevant clues.
  • live-crickets case: The “live-crickets” case presents main-branch trajectories and lookahead branches across Tables 7–9.
Loading 2603.27490v1…