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

TL;DR

Training AI agents for complex terminal tasks is hindered by the difficulty of creating realistic, executable, and verifiable training data. This paper introduces TerminalTraj, a scalable pipeline that automates the generation of such data by leveraging Dockerized environments and executable validation, leading to significant performance improvements in AI agents.

What Problem Does This Paper Address?

Modern AI agents are increasingly capable of complex, multi-turn reasoning, but evaluating them in realistic scenarios, especially those involving terminal interactions, is challenging. Existing benchmarks often simplify or omit crucial aspects like execution constraints and tool-mediated interactions. While TerminalBench (TB) was developed to address this by evaluating agents in terminal environments, creating large-scale, high-quality training data for these tasks is a major bottleneck. The core challenges are:

  1. Executability: Each training instance requires a specific, often distinct, Docker environment to run. Setting these up manually or through simple heuristics is not scalable.
  2. Verifiability: Heterogeneous outputs from terminal tasks make it difficult to establish a unified, standardized way to verify if an agent's actions were correct.

These issues limit the ability to train agents that can perform reliably in real-world terminal workflows, where success often hinges on precise execution, filesystem states, and dependency resolution.

Methods

The paper proposes TerminalTraj, a pipeline designed to overcome these data generation challenges:

  • Model-Based Repository Filtering: Instead of relying on simple heuristics like GitHub stars, TerminalTraj uses a learned "ScoreModel" to assess the quality and executability of GitHub repositories. This allows for automated, scalable identification of high-quality repositories suitable for creating Docker environments.
  • Dockerfile Curation and Environment Building: The pipeline filters repositories to find Dockerfiles and then automatically constructs Docker images. For domain-specific tasks, it injects necessary dependencies to ensure a robust execution sandbox.
  • Instance Generation and Synthesis: TerminalTraj generates task instances by synthesizing queries and, crucially, executable validation code (e.g., pytest suites). This executable validation allows for state-based verification of agent actions, ensuring that the agent's output is not just textually correct but functionally so.
  • Domain-Specific Data Augmentation: Beyond general-purpose code, the pipeline curates instances from eight specialized domains (e.g., Web Service, SQL, Security, QEMU) to capture diverse task requirements, tools, and dependencies.
  • Trajectory Rolling and Verification: Agents are deployed within these Dockerized environments to generate trajectories, which are then rigorously verified using the generated executable validation code.

Datasets

  • TerminalBench (TB) 1.0 and 2.0: These are the primary benchmarks used for evaluating the performance of AI agents trained on the generated data. They represent realistic terminal environments for evaluating agentic capabilities.
  • TerminalTraj Dataset: This is the newly generated dataset. It comprises:
  • 32,325 Docker images.
  • 50,733 verified terminal trajectories.
  • These are curated from 899,741 initial GitHub repositories across eight programming languages and eight specialized domains.

Key Insights and Ideas

  • Executable Validation is Key: The paper strongly emphasizes that relying on LLM judges or static verification is insufficient for terminal tasks. Generating executable validation code (like pytest) is crucial for ensuring true task completion and preventing "hallucinated" successes.
  • Scalable Environment Generation: The model-based repository scoring approach is a significant step towards scaling the creation of diverse and executable environments, overcoming a major bottleneck in agent training data generation.
  • Domain Diversity Matters: The ablation studies show that incorporating data from specialized domains significantly boosts agent performance, highlighting the importance of diverse, real-world task scenarios.
  • Test-Time Scaling Benefits: Agents trained on TerminalTraj data exhibit improved "test-time scaling," meaning they can leverage additional inference compute more effectively to improve performance, a crucial aspect for practical deployment.

Key Results

  • Performance Gains: Models trained on TerminalTraj data (using the Qwen2.5-Coder backbone) showed significant improvements on TerminalBench:
  • Up to 20% gain on TB 1.0.
  • Up to 10% gain on TB 2.0.
  • State-of-the-Art for Parameter Size: The TerminalTraj-32B model achieved performance comparable to much larger models (e.g., Qwen3-Coder-480B) while using fewer than 100B parameters, demonstrating remarkable scale efficiency. Specifically, it reached 35.30% on TB 1.0 and 22.00% on TB 2.0.
  • Improved Test-Time Scaling: TerminalTraj-trained models showed a steeper pass@k scaling curve, with TerminalTraj-32B reaching 63% pass@16, outperforming even larger models.
  • Dataset Quality: The generated dataset is shown to be of high quality, with instance quality correlating strongly with repository scores.

Limitations and Future Work

  • License Compliance: The authors meticulously address license compliance, excluding repositories without explicit licenses or with incompatible terms. They commit to preserving license texts and attribution for released data.
  • Privacy and Security Filtering: While extensive filtering is applied to remove sensitive information, the authors acknowledge that automated filtering may not achieve perfect recall.
  • Potential Risks of Autonomous Agents: The paper highlights the inherent risks of agents executing terminal commands (e.g., destructive actions). They emphasize that their pipeline mitigates this during training by using sandboxed Docker environments and recommend rigorous sandboxing for any deployment.
  • Future Work: The authors suggest that their interactive tasks naturally support online learning paradigms like reinforcement learning (RL), indicating future research directions. They also believe that further performance gains are achievable by training larger backbone models with their data.

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