LLM-powered AI agents require high-frequency state exploration (e.g., test-time tree search and reinforcement learning), relying on rapid checkpoint and rollback (C/R) of the complete sandbox state, including files and process state (e.g., memory, contexts, etc.). Existing mechanisms duplicate the entire state, causing hundreds of milliseconds to seconds of latency per C/R, which severely bottlenecks deep search and large-scale fan-outs. This paper observes that subsequent checkpoints in AI agents are highly similar. Therefore, instead of full duplication, a sandbox should only duplicate the changes between consecutive checkpoints (Key Insight). However, it is non-trivial to realize the idea, mainly due to the missing OS supports. This paper proposes a new OS-level abstraction, DeltaState, to enable the change-based transactional C/R for AI agents with two co-designed OS mechanisms. First, DeltaFS enables change-based filesystem C/R by organizing the file states into layers and dynamically freezing the writable layer and inserting a new one during checkpoint, reducing file updates to copy-on-write, and making rollback a simple layer switch. Second, DeltaCR enables change-based process state C/R using incremental dumps, and accelerates rollback by bypassing traditional pipelines to directly fork() from a frozen template process. We then present DeltaBox, a novel agent sandbox achieving millisecond level C/R through the two new mechanisms. Evaluations on SWE-bench and RL micro-benchmarks show DeltaBox completes checkpoint and rollback in millisecond-level latency (14ms and 5ms, respectively), empowering agents to explore substantially more nodes under fixed time budgets.
翻译:基于大语言模型的AI代理需要高频状态探索(如测试时树搜索和强化学习),这依赖于对包含文件与进程状态(如内存、上下文等)的完整沙箱状态进行快速检查点/回滚操作。现有机制通过完整状态复制导致每次检查点/回滚产生数百毫秒至数秒延迟,严重制约深度搜索和大规模扇出操作。本文观察到AI代理中连续检查点具有高度相似性,因此沙箱应仅复制连续检查点间的变更(核心洞察)而非全量复制。然而,由于操作系统支持的缺失,实现该构想面临重大挑战。本文提出新型操作系统级抽象DeltaState,通过两个协同设计的操作系统机制实现基于变更的AI代理事务性检查点/回滚。首先,DeltaFS通过将文件状态组织为分层结构,在检查点时动态冻结可写层并插入新层,将文件更新降级为写时复制,使回滚简化为分层切换,从而实现基于变更的文件系统检查点/回滚。其次,DeltaCR采用增量转储实现基于变更的进程状态检查点/回滚,并通过绕过传统管线直接从冻结模板进程执行fork()来加速回滚。我们进而提出DeltaBox——通过上述两种新机制实现毫秒级检查点/回滚的新型代理沙箱。在SWE-bench和强化学习微基准测试中的评估表明,DeltaBox的检查点和回滚延迟分别达到14毫秒和5毫秒的毫秒级水平,使代理能在固定时间预算下探索显著更多的节点。