HyperAIHyperAI

Command Palette

Search for a command to run...

Terminal-Universe: Umwandlung von Agenten-Trajektorien in skalierbare Terminal-Umgebungen

Zusammenfassung

Mit der zunehmenden Verbreitung terminalbasierter Code-Agenten fallen entsprechende Agenten-Trajektorien in großem Umfang an, während realistische, ausführbare Umgebungen weiterhin knapp sind. Gerade Umgebungen sind jedoch das, was das Post-Training von Agenten tatsächlich benötigt: Jede einzelne kann in viele verifizierbare Aufgaben umgewandelt werden und liefert das Ausführungsfeedback, wohingegen eine Trajektorie eine einzelne, eingefrorene Demonstration darstellt. Anstatt Umgebungen von Grund auf neu zu generieren, beobachten wir, dass der Werkzeugausführungsverlauf in den bestehenden Agenten-Trajektorien die Struktur und die Inhalte der Umgebungen offenlegt, in denen sie ausgeführt wurden, und es so ermöglicht, diese Umgebungen aus den Trajektorien selbst zu rekonstruieren. Daher stellen wir Terminal-Universe vor, ein Framework, das jede Trajektorie in eine wiederverwendbare Umgebung überführt und diese zur Synthese neuer Aufgaben und fortgesetzter Interaktionen exploriert. Konkret spielt Terminal-Universe die in einer Trajektorie aufgezeichneten Dateioperationen nach, um jede Datei in den Zustand vor ihrer Modifikation durch den Agenten zurückzuversetzen, wodurch ein partieller Arbeitsbereich entsteht; ein Vervollständigungsagent ergänzt anschließend die fehlenden Dateien und Abhängigkeiten. Auf diesem wiederhergestellten Arbeitsbereich rekonstruieren wir sowohl die ursprüngliche Aufgabenstellung als auch synthetisieren wir vollständig neue Aufgaben. Darüber hinaus skalieren wir die Aufgaben für die entsprechende Umgebung entlang zweier komplementärer Achsen – Breite und Tiefe –, um ein typisches Muster realer Ingenieurspraxis nachzubilden. Für die Breite extrahieren wir gerichtete Abhängigkeitsbeziehungen zwischen verwandten Umgebungen und synthetisieren arbeitsbereichsübergreifende Abfragen, die mehrere Codebasen umfassen, wie es Entwickler in der realen Entwicklung routinemäßig tun. Für die Tiefe erweitern wir die anfängliche Einzelrunden-Abfrage zu einer mehrrundigen Sitzung, die iteratives Nutzerfeedback und Anforderungsverfeinerung mittels eines Nutzeragenten abbildet. Angewandt auf öffentlich verfügbare Terminal-Agenten-Trajektorien erzeugt Terminal-Universe 37,3 Tsd. aufgabenadäquate Umgebungen. Die überwachte Feinabstimmung von Qwen3.5-27B auf diesem Korpus verbessert die Einzelrunden-Leistung auf Terminal-Bench 2.1 um 11,9 Punkte und die Mehrrunden-Leistung auf EvoCode-Bench v2 MT@4 um 13,8 Punkte.

One-sentence Summary

The Qwen Team (Alibaba Group) and Tsinghua University propose Terminal-Universe, a framework that reconstructs reusable terminal environments from agent trajectories by replaying file operations and using a completion agent to restore missing dependencies, then synthesizes new tasks along breadth (cross-workspace queries via directional dependency relations) and depth (multi-round user-agent sessions); applied to 37.3k task-sufficient environments, supervised fine-tuning of Qwen3.5-27B 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.

Key Contributions

  • Terminal-Universe reconstructs reusable execution environments from recorded agent trajectories by deterministically replaying file operations and using a completion agent to supply missing dependencies, then synthesizes new verifiable tasks on those recovered workspaces.
  • Terminal-Universe introduces two complementary scaling axes: breadth expansion that mines directional dependency relations between environments to create cross-workspace queries, and depth expansion that extends single-turn tasks into multi-round sessions with a simulated user agent for iterative feedback.
  • Applied to publicly available terminal-agent trajectories, the method produces 37.3k task-sufficient environments; supervised fine-tuning of Qwen3.5-27B on this data improves single-round Terminal-Bench 2.1 by 11.9 points and multi-round EvoCode-Bench v2 MT@4 by 13.8 points.

Introduction

The authors address a scaling bottleneck in training terminal-based code agents: while agent trajectories accumulate rapidly, reusable executable environments remain scarce. An environment is far more valuable than a fixed trajectory because it allows re-solving with stronger models, verifying correctness with tests, and posing harder tasks on the same workspace. Prior work constructs environments from repository histories, bug injection, or task-conditioned synthesis, but these approaches are limited to repair tasks, lack realism, or cannot scale beyond manual curation. The authors propose Terminal-Universe, a framework that reconstructs executable workspaces from recorded trajectories by replaying file operations and using an agent to fill missing dependencies without leaking solutions. It then synthesizes new tasks along two axes—cross-workspace breadth and multi-round depth—and pairs each with an agent-written verifier. Training on this corpus yields substantial gains on terminal-agent benchmarks, and re-solving in reconstructed environments far outperforms imitating the original trajectories.

Dataset

The authors construct a supervised fine-tuning (SFT) corpus from diverse terminal-style CLI and software-engineering agent trajectories. Here’s how the dataset is built and used:

  • Seed selection Raw execution traces are sourced from multiple terminal and software-engineering corpora. A trace is kept only if its final workspace contains at least 5 files and 100 lines. All Terminal-Bench-derived sources are excluded to prevent leakage.

  • Environment reconstruction and sufficiency filtering The pipeline reconstructs 68,263 environments. Initially, replayed workspaces are sparse (mean 2.9 files) because solution files are withheld. Agentic completion enriches them to a mean of 22.4 files. After contamination filtering and repository-level deduplication, a sufficiency judge evaluates 38,294 terminal and 1,900 SWE environments. Agentic completion lifts sufficiency rates from 40.2% (terminal) / 20.1% (SWE) to 93.5% / 77.1%, yielding 37,273 fully sufficient environments. The terminal pool is dominated by Python (84.7%), with C++ and C also present; data processing, DevOps, and security workloads cover over 80% of technical domains.

  • Task generation and verification From the sufficient environments, four re-querying variants produce tasks: Intent Recovery (original tasks), Single-WS (novel within-repo tasks), Cross-WS (inter-repo dependency challenges), and Multi-Round (iterative sessions). Each task is paired with an agent-authored pytest verifier that runs inside the target container. Candidate solutions are rolled out by a teacher model (temperature 1.0, top-p 0.95, 256k-token context, max 500 turns, 4-hour timeout). For Single-WS and Cross-WS, a trajectory is accepted only if all tests pass on the final workspace state. Multi-Round sessions are trimmed by removing trailing consecutive failed rounds and kept if at least two verified passing rounds remain; intermediate failures are preserved for error-recovery supervision. All accepted trajectories undergo strict decontamination against evaluation benchmarks.

  • Final SFT corpus Verifier-filtered synthesis produces 31,977 multi-turn SFT demonstrations, totalling approximately 1.42B training tokens. The composition:

    • Single-WS: 25,386 trajectories
    • Cross-WS: 3,512 trajectories
    • Multi-Round: 3,079 trajectories

    The dataset is used directly for supervised fine-tuning, with each demonstration providing a validated agent interaction that includes error diagnosis and recovery steps where applicable.

Method

The authors present Terminal-Universe, a comprehensive framework for generating high-quality terminal agent trajectories. The pipeline consists of three core phases: environment reconstruction, re-querying, and verification.

As shown in the framework diagram, the process begins with environment reconstruction to recover an executable workspace E^\widehat{E}E from a recorded trajectory τ\tauτ.

This recovery occurs in three stages. First, deterministic replay processes the read, write, and edit operations in τ\tauτ chronologically to recover the earliest and latest file contents for each accessed path, yielding a partial initial workspace E^0\widehat{E}_0E0. Second, agentic completion employs a completion agent to create missing files, complete partial files, and restore dependencies, resulting in a completed workspace E^\widehat{E}E. Finally, environment filtering uses an agentic judge to inspect each E^\widehat{E}E with read-only tools, retaining only those workspaces that provide sufficient project context to support the recovered task. Each reconstructed workspace operates within a standardized Ubuntu container with network access.

Following reconstruction, the authors introduce four complementary re-querying mechanisms to exploit the latent capability space of the workspaces. Intent Recovery consolidates source user requests into a self-contained task by normalizing the trajectory into a chronological stream of requests, actions, and file changes. Single-workspace synthesis derives new queries from individual workspaces, where an offline generator inspects the workspace and synthesizes candidate tasks under groundedness, structural diversity, and verifiability constraints. Cross-workspace synthesis provides breadth by connecting related workspaces. An agent profiles each workspace technical domain, and candidate pairs are retrieved via TF-IDF nearest-neighbor search. An LLM judge identifies directional dependency edges, and a task generator specifies observable behaviors to bridge the functional gap. Multi-round continuation extends an initial query into an interactive session. A user agent maintains an explicit requirement tracker and employs round-level verification and feedback. The user agent requests naturally fall into feature extension, feature revision, or feature conflict styles based on the round outcome.

The verification and filtering phase ensures the quality of the generated data. For Single-WS and Cross-WS tasks, an agentic verifier constructs a self-contained pytest suite within the target container. Candidate solutions are rolled out using a teacher model within a coding scaffold, decoding with specific temperature and top-p parameters over a large context window. A trajectory is accepted only if all tests pass against the final workspace state. For Multi-Round sessions, selection occurs at the round level. Trailing suffixes of consecutive failed rounds are trimmed from terminated sessions, and a session is retained only if it contains at least two verified passing rounds.

The pass and fail patterns for the continuation data are illustrated below.

Intermediate failures preceding a successful recovery are kept to supply supervision for error diagnosis and recovery. Accepted trajectories are formatted into multi-turn SFT demonstrations and undergo strict decontamination against evaluation benchmarks.

Experiment

Fine-tuning Qwen3.5-27B on a verifier-filtered mixture of single-workspace, cross-workspace, and multi-round re-querying trajectories substantially improves terminal-agent performance, with the full mixture yielding strong gains on both single-round and persistent cumulative benchmarks. Ablation studies show that re-solving tasks in reconstructed environments with agentic completion and verifier filtering provides more effective supervision than imitating original trajectories or using deterministic replay alone. Cross-workspace synthesis expands task breadth and particularly benefits complex categories like software engineering, while multi-round depth expansion with round-level verification improves the model's ability to handle long, cumulative request sequences. Under a fixed data budget, adding more distinct environments is more valuable than generating extra queries or solutions per environment, and the pipeline generalizes beyond terminal workspaces, transferring to software-engineering trajectories to improve terminal-agent behavior.

All compared environment construction methods provide executable verifiers but none support multi-round interaction or cross-workspace synthesis. Ablation experiments show that adding multi-round data with round-level verification improves performance on persistent tasks, and that expanding the number of distinct environments yields larger gains than adding extra queries or solutions per environment. Cross-domain trajectories from software-engineering workspaces also transfer to terminal-agent tasks, boosting results. Every method in the comparison includes an executable verifier, yet none incorporate multi-round or cross-workspace capabilities. CLI-Gym creates 1,655 tasks from only 29 source environments via perturbation, while RST recursively scales to 37.5k environments and tasks. OpenThinker-Agent reports 100k tasks without counting reusable environments, unlike methods that pair each task with a distinct workspace. Multi-round depth expansion raises MT@4 and Case score, and removing round-level verifier feedback reduces both metrics. Under a fixed data budget, adding new environments improves performance, whereas adding extra queries or solutions over the same workspaces yields negligible change. Training on trajectories reconstructed from software-engineering workspaces improves terminal-bench scores, demonstrating cross-domain transfer.

Deterministic replay alone leaves most workspaces task-insufficient, with only 40% of terminal and 20% of SWE environments meeting the sufficiency bar. Agentic completion substantially enriches these environments, raising sufficiency to 94% for terminal and 77% for SWE workspaces, thereby restoring the execution context needed for downstream task generation. Replay-only reconstruction yields low sufficiency: 40.2% for terminal workspaces and 20.1% for SWE repositories. Agentic completion dramatically improves sufficiency to 93.5% (terminal) and 77.1% (SWE), making most environments usable. The completion step restores missing execution context that deterministic replay cannot provide, consistent with later training improvements.

The base Qwen3.5-27B model achieves moderate terminal task scores but struggles on persistent multi-round tasks, while prior task synthesis methods lag far behind with zero multi-round completion. Fine-tuning on a verifier-filtered mixture of single- and multi-round trajectories boosts both terminal and cumulative task performance substantially, with environment expansion and multi-round data proving critical. Qwen3.5-27B base scores 41.6% on Terminal-Bench 2.0 and 6.3 MT@4 on EvoCode-Bench v2, compared to the teacher Qwen3.7-Max at 69.7% and 39.8. Existing synthesis methods TerminalTraj-32B and TermiGen-32B achieve only 22.0% and 19.3% on Terminal-Bench 2.0 and fail completely on multi-round sequences (MT@4 of 0.0). Full Mixture training raises Qwen3.5-27B to 52.8% on Terminal-Bench 2.0 and 20.1 MT@4, more than tripling the multi-round completion rate. Under a fixed data budget, adding new environments improves Terminal-Bench 2.1 from 53.2 to 56.0, while adding queries or solutions yields negligible gains. Multi-round data addition increases MT@4 from 18.4 to 21.0 and Case score from 71.9 to 76.9, showing better handling of cumulative requirements.

Re-solving tasks with a consistent teacher policy (Intent Recovery) yields substantially stronger supervision than directly imitating the original agent's trajectories. Using the same amount of data, Intent Recovery raises the average score from 36.7 to 52.1, indicating that regenerating demonstrations under a unified policy is more effective than preserving the original behavior. Intent Recovery improves average performance by over 15 percentage points relative to source-trajectory SFT. The improvement is consistent across both evaluation scaffolds, with Claude Code and Terminus2-XML scores rising markedly.

Adding agentic completion to Intent Recovery replay substantially improves performance on Terminus2-XML, lifting the score from 48.7 to 52.9 while using the same 35.8k training records. The base model without any replay achieves 46.2, so replay alone provides a modest gain, but combining it with agentic completion yields the strongest result. Replay + agentic completion outperforms replay only by a clear margin (52.9 vs. 48.7). The base model without replay scores lowest (46.2), confirming that both replay and agentic completion contribute positively.

The experiments evaluate environment construction and training strategies for terminal agents, revealing that existing methods lack multi-round interaction and cross-workspace synthesis, and that deterministic replay alone leaves most workspaces insufficient, a limitation largely overcome by agentic completion. Fine-tuning on verifier-filtered mixtures of single- and multi-round trajectories, with an emphasis on expanding distinct environments rather than adding extra queries per environment, substantially improves both single-task and persistent multi-round performance, while cross-domain trajectories from software-engineering workspaces transfer effectively. Additionally, re-solving tasks with a consistent teacher policy (Intent Recovery) yields stronger supervision than directly imitating source trajectories, and combining agentic completion with replay provides the largest gains, confirming the importance of restoring execution context and using unified demonstrations.


KI mit KI entwickeln

Von der Idee bis zum Launch – beschleunigen Sie Ihre KI-Entwicklung mit kostenlosem KI-Co-Coding, sofort einsatzbereiter Umgebung und bestem GPU-Preis.

KI-gestütztes kollaboratives Programmieren
Sofort einsatzbereite GPUs
Die besten Preise

HyperAI Newsletters

Abonnieren Sie unsere neuesten Updates
Wir werden die neuesten Updates der Woche in Ihren Posteingang liefern um neun Uhr jeden Montagmorgen
Unterstützt von MailChimp