The researchers introduce ContextPilot, a proactive context management framework designed to optimize long-horizon agentic reasoning in Large Language Models (LLMs). Recognizing that growing interaction histories create inefficient working contexts, the authors address current limitations in tool diversity, exploration efficiency, and credit assignment. Unlike existing methods restricted to basic search, deletion, and summarization, ContextPilot expands the agent's toolset to include global planning, long-term memory, and soft context offloading. To optimize these actions, the framework employs a specialized Reinforcement Learning (RL) method. This approach utilizes context and entropy variation to perform branch sampling, identifying critical editing decisions, and estimates action-level advantages by aggregating rewards from all branched trajectories passing through a specific context editing action. This fine-grained credit assignment overcomes the limitations of coarse-grained, trajectory-level rewards. Experimental results on long-context question answering (QA) and deep search tasks demonstrate that ContextPilot consistently outperforms existing baselines. The method enables agents to achieve superior performance while maintaining a significantly more compact working context across various base models and benchmarks, effectively managing the trade-off between information retention and computational efficiency.

Read original