Large-Scale Terminal Agentic Trajectory Generation from Dockerized Environments

Siwei Wu, Yizhi Li, Yuyang Song, Wei Zhang, Yang Wang, Riza Batista-Navarro, Xian Yang, Mingjie Tang, Bryan Dai, Jian Yang, Chenghua Lin · DOI

TL;DR

TerminalTraj is a new, large-scale pipeline designed to train AI agents for terminal-based tasks by grounding them in real-world execution. By curating over 32,000 Dockerized environments and 50,000 verified trajectories, the authors demonstrate that training on actual execution data—rather than LLM-simulated interactions—leads to massive performance gains, allowing a 32B model to rival the performance of models ten times its size.

What Problem Does This Paper Address?

Building AI agents that can navigate a Linux terminal is notoriously difficult. Unlike standard code generation, terminal tasks are "long-horizon" and highly dependent on the environment: success often hinges on specific file system states, installed dependencies, and tool-mediated side effects that are only observable at runtime.

Current methods for generating training data face two major hurdles:

  1. Executability: Each task needs a specific, reproducible environment (usually a Docker container). Manually creating these doesn't scale, and automated filtering of GitHub repositories often results in "broken" environments that won't build.
  2. Verifiability: How do you know the agent actually finished the task? Many existing datasets rely on "LLM-as-a-judge," which can be fooled by plausible-sounding but incorrect terminal output.

Methods

The authors introduce the TerminalTraj Pipeline, which automates the transition from static code repositories to dynamic, verifiable agent tasks through three main stages:

  • Predictive Quality Filtering: Instead of relying on "star counts" or simple heuristics, they trained a lightweight ScoreModel (based on Qwen2.5-Coder-0.5B) to predict the completeness and executability of a repository. This doubled the success rate of building Docker images compared to random sampling.
  • Automated Dockerization: They successfully built 32,325 distinct Docker images across eight programming languages, ensuring each task has a "home" where its dependencies actually work.
  • Generate-and-Verify Loop: For each environment, an LLM generates a task query and—crucially—a pytest validation suite. An agent then attempts the task within the Docker container. The trajectory is only saved if it passes the executable pytest script, providing a "ground-truth gatekeeper" that eliminates hallucinations.

Datasets

  • TerminalTraj (New): The primary contribution, featuring 50,733 verified trajectories across 32,325 Docker images. It covers eight specialized domains, including Security, QEMU (system emulation), SQL, and Multimodal tasks.
  • TerminalBench (TB 1.0 & 2.0): Used for evaluation. These are rigorous benchmarks for testing terminal agents in realistic settings.
  • Nex-N1: A prior large-scale dataset used as a baseline. Unlike TerminalTraj, Nex-N1 relies more on rule-based designs and LLM judges rather than grounded execution.

Key Insights and Ideas

  • Execution Grounding is Non-Negotiable: The paper shows that models trained on trajectories verified by actual code execution significantly outperform those verified by LLM judges. Code-based verification is much better at identifying high-quality reasoning steps.
  • The "Environment Scarcity" Bottleneck: The authors argue that the lack of diverse, executable environments is the real ceiling for agent performance. By automating Docker curation, they moved from hundreds of environments to tens of thousands.
  • Test-Time Scaling: One of the most exciting findings is that models trained on TerminalTraj show a "steeper" scaling curve. This means that when you allow the model to sample multiple attempts (pass@k), the grounded training helps it "search" for the correct solution more effectively than models trained on ungrounded data.
  • Domain Diversity Matters: Through ablation studies, the authors found that excluding specific domains like "Web Service" or "QEMU" led to significant performance drops, proving that agents need exposure to diverse system-level interactions to become robust.

Key Results

  • Massive Performance Boosts: Fine-tuning Qwen2.5-Coder on TerminalTraj yielded absolute gains of up to 20% on TerminalBench 1.0 and 10% on TB 2.0 over the base models.
  • Punching Above Its Weight: The TerminalTraj-32B model achieved a score of 35.30% on TB 1.0. This is state-of-the-art for models under 100B parameters and is comparable to the performance of the much larger Qwen3-Coder-480B.
  • Superior Scaling: At pass@16 (16 attempts), TerminalTraj-32B reached a 63% success rate, effectively surpassing the performance of massive closed-source and open-source models.

Limitations and Future Work

  • Build Success Rate: Even with predictive filtering, the Docker build success rate was around 17%. While high for automated pipelines, there is still a vast amount of "wasted" repository data that could be reclaimed with better environment-repair techniques.
  • SFT vs. RL: This paper focused primarily on Supervised Fine-Tuning (SFT). The authors note that their interactive, verifiable tasks are a perfect fit for Reinforcement Learning (RL), which could further unlock agent capabilities.
  • Safety: The authors acknowledge that terminal agents can be destructive (e.g., deleting files). While they use isolated Docker containers for training, they emphasize the need for rigorous sandboxing (like gVisor) in any real-world deployment.

Summary updated

BibTeX
@inproceedings{wu2026large,
  author = {Siwei Wu and Yizhi Li and Yuyang Song and Wei Zhang and Yang Wang and Riza Batista-Navarro and Xian Yang and Mingjie Tang and Bryan Dai and Jian Yang and Chenghua Lin},
  title = {{Large-Scale Terminal Agentic Trajectory Generation from Dockerized Environments}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=PeFSCRulgy},
}
Figure