Trae Agent: An LLM-based Agent for Software Engineering with Test-time Scaling

Pengfei Gao, Zhao Tian, Xiangxin Meng, Xinchen Wang, Ruida Hu, Yuanan Xiao, Yizhou Liu, Zhao Zhang, Junjie Chen, Cuiyun Gao, Yun Lin, Yingfei Xiong, Chao Peng, Xia LiuarXiv 2025 · DOI

Abstract

Trae Agent is a novel agentic framework designed to tackle complex, repository-level software bugs by shifting the focus from model training to "test-time scaling." By generating an ensemble of potential fixes and utilizing specialized modular agents to prune and select the optimal solution, Trae Agent achieved a record-breaking 75.20% Pass@1 score on the SWE-bench Verified leaderboard.

Introduction

While Large Language Models (LLMs) excel at isolated coding tasks, real-world software engineering requires "repository-level understanding"—the ability to reason across multiple files, manage complex dependencies, and verify fixes within a large codebase. Existing ensemble approaches, which generate multiple solutions and select one, face two primary hurdles: search space explosion and stateless selection. As the number of candidate patches increases, identifying the correct fix becomes a "needle in a haystack" problem, often exacerbated by the lack of deep context in standard LLM prompts.

Methods: The Trae Agent Pipeline

Trae Agent formulates issue resolution as an optimal solution search problem, implemented through a three-stage modular pipeline.

The Trae Agent modular pipeline for patch generation, pruning, and selection.

1. Patch Generation

A specialized Coder Agent utilizes a suite of tools—including file editing, bash commands, and sequential thinking—to explore the codebase and generate diverse candidate patches. To maximize the diversity of the solution pool, the system employs high-temperature sampling and a "Mixture" configuration that rotates between top-tier models such as GPT-4o, Claude 3.7, and Gemini 2.5 Pro.

2. Patch Pruning

To manage the expanded search space, Trae Agent applies hierarchical filtering:

  • Deduplication: Code is normalized by removing comments and whitespace to merge semantically identical patches.
  • Regression Testing: A Tester Agent identifies relevant existing tests. Patches failing these "golden" tests are immediately discarded, removing approximately 40% of redundant or broken candidates.

3. Patch Selection

The Selector Agent simulates a human developer's comprehension process. Instead of a simple code review, it performs static analysis and dynamic verification by writing and executing its own unit tests. A majority voting strategy across parallel selector runs is used to mitigate hallucinations and ensure robustness.

Results and Discussion

The framework was evaluated on SWE-bench Verified, a curated subset of 500 real-world GitHub issues. Trae Agent secured first place on the leaderboard with a 75.20% Pass@1 score, outperforming state-of-the-art baselines like Augment and DeiBase by an average of 10.22%.

Performance comparison across different models and ensemble sizes, highlighting the 'Oracle' gap and scaling behavior.

Key Insights

  • The "Oracle" Gap: Evaluation shows that while the best possible performance (the "Oracle") improves with ensemble size, the performance of a random guess ("Average") remains flat, and worst-case performance ("Adversary") drops. This underscores the necessity of a structured selection process.
  • Test-Time Scaling: Performance improves significantly as more inference-time compute is allocated to agent steps and parallel verification runs. Unlike other methods that degrade with larger ensembles, Trae Agent’s performance continues to climb.

Conclusion

Trae Agent demonstrates that scaling compute at inference time through a modular, agentic workflow is highly effective for complex software engineering tasks. While the approach involves higher computational costs, the significant gains in accuracy and the ability to leverage the "Oracle" potential of LLMs represent a major step forward in automated repository-level bug resolution. Future work will focus on refining regression test precision and exploring more diverse Coder Agent architectures.

Summary updated

BibTeX
@misc{gao2025trae,
  author = {Pengfei Gao and Zhao Tian and Xiangxin Meng and Xinchen Wang and Ruida Hu and Yuanan Xiao and Yizhou Liu and Zhao Zhang and Junjie Chen and Cuiyun Gao and Yun Lin and Yingfei Xiong and Chao Peng and Xia Liu},
  title = {{Trae Agent: An LLM-based Agent for Software Engineering with Test-time Scaling}},
  year = {2025},
  eprint = {2507.23370},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.23370},
}
Figure