终端宇宙:将智能体轨迹转化为可扩展的终端环境

·

研究论文 · 2026/09/04

随着基于终端的代码代理变得普遍,代理轨迹大规模积累,而现实可执行的环境仍然稀缺。然而,环境正是代理后训练所需的:每个环境都可以被重新查询以生成许多可验证的任务,并提供执行反馈,而轨迹只是单一的冻结演示。我们观察到,现有轨迹中的工具执行历史暴露了其运行环境的结构和内容,因此可以从轨迹本身重建这些环境。为此,我们提出了Terminal-Universe框架,该框架将每个轨迹转化为可重用的环境,并探索它以合成新任务和持续交互。具体来说,Terminal-Universe重放轨迹中记录的文件操作,在代理修改之前恢复每个文件,从而产生部分工作区;然后由完成代理补充缺失的文件和依赖。在这个恢复的工作区上,我们既重建原始意图任务,也合成全新的任务。此外,我们沿两个互补轴扩展任务:广度和深度。广度方面,我们挖掘相关环境之间的方向依赖关系,并合成跨工作区查询,跨越多个代码库,正如开发者在现实开发中经常做的那样。深度方面,我们将初始的单轮查询扩展为多轮会话,通过用户代理捕获迭代的用户反馈和需求细化。将Terminal-Universe应用于公开的终端代理轨迹,我们产生了37.3k个任务充分的环境。在此语料库上对Qwen3.5-27B进行监督微调,在Terminal-Bench 2.1上将单轮性能提高了11.9个百分点,在EvoCode-Bench v2 MT@4上将多轮性能提高了13.8个百分点。

该文提出了一种新颖的框架,将丰富的代理轨迹转化为稀缺的可执行环境,为代理后训练提供了数据来源。方法具有实用性和可扩展性,实验证明能显著提升代理性能,对代码智能体领域有重要价值。

As terminal-based code agents become prevalent, agent trajectories have accumulated at scale, while realistic, executable environments remain scarce. However, environments are what agent post-training actually requires: each can be re-queried into many verifiable tasks and provides execution feedback, whereas a trajectory is a single frozen demonstration. Rather than generating environments from scratch, we observe that the tool-execution history in existing trajectories exposes the structure and contents of the environments in which they ran, making it possible to reconstruct those environments from the trajectories themselves. Thus, we introduce Terminal-Universe, a framework which turns each trajectory into a reusable environment and explores it for synthesizing new tasks and continued interactions. Specifically, Terminal-Universe replays the file operations recorded in a trajectory to restore each file before the agent modified it, yielding a partial workspace; a completion agent then supplies the missing files and dependencies. On this recovered workspace, we both reconstruct the original intent task and synthesize entirely new ones. Besides, we also scale the tasks along two complementary axes: breadth and depth. For breadth, we mine directional dependency relations between related environments and synthesize cross-workspace queries spanning multiple codebases, as developers routinely do in real-world development. For depth, we extend the initial single-turn query into a multi-round session that captures iterative user feedback and requirement refinement via a user agent. Applied to public terminal agent trajectories, Terminal-Universe produces 37.3k task-sufficient environments. Supervised fine-tuning of Qwen3.5-27B on this corpus improves single-round performance on Terminal-Bench 2.1 by 11.9 points and multi-round performance on EvoCode-Bench v2 MT@4 by 13.8 points.

阅读原文

参与讨论