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

📄 arXiv: 2507.23370v1 📥 PDF

作者: Trae Research Team, 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 Liu

分类: cs.SE, cs.AI

发布日期: 2025-07-31

备注: Pengfei Gao and Zhao Tian contributed equally to this technical report

🔗 代码/项目: GITHUB


💡 一句话要点

Trae Agent:基于LLM的软件工程智能体,具备测试时扩展能力,解决代码缺陷。

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 代码修复 大型语言模型 软件工程 智能体 集成推理

📋 核心要点

  1. 现有基于提示的集成推理方法难以有效探索大型集成空间,且缺乏对代码仓库级别的理解,限制了问题解决能力。
  2. Trae Agent 采用基于代理的集成推理方法,将问题转化为最优解搜索,通过模块化代理实现生成、剪枝和选择。
  3. 实验表明,Trae Agent 在 SWE-bench 基准测试中优于现有方法,Pass@1 指标平均提升 10.22%,达到 75.20% 的领先水平。

📝 摘要(中文)

软件问题解决是软件工程中的一项关键挑战,近年来受到越来越多的关注。随着大型语言模型(LLM)的快速发展,在解决实际软件工程任务方面取得了显著进展。最近的研究引入了集成推理技术来提高基于LLM的问题解决性能。然而,现有的基于提示的方法在有效探索大型集成空间方面仍然面临限制,并且缺乏存储库级别的理解能力,这两者都限制了它们的整体有效性。在本文中,我们提出了Trae Agent,这是第一个用于存储库级别问题解决的基于代理的集成推理方法。Trae Agent将我们的目标定义为最优解搜索问题,并通过用于生成、修剪和选择的模块化代理来解决两个关键挑战,即大型集成空间和存储库级别的理解。我们使用三个领先的LLM在广泛使用的SWE-bench基准上进行了大量实验,将Trae Agent与四种最先进的集成推理技术进行了比较。实验结果表明,Trae Agent始终如一地实现了卓越的性能,在Pass@1方面,平均比所有基线提高了10.22%。Trae Agent在SWE-bench Verified排行榜上名列第一,Pass@1得分高达75.20%。我们很高兴将Trae Agent作为开源项目发布,以支持研究社区,所有资源都可以在https://github.com/bytedance/trae-agent上找到。

🔬 方法详解

问题定义:论文旨在解决软件工程中代码缺陷自动修复的问题。现有基于LLM的集成推理方法在处理大型代码仓库时,面临搜索空间巨大、难以有效利用仓库级别信息的挑战,导致修复效果不佳。

核心思路:Trae Agent的核心思路是将代码修复过程建模为最优解搜索问题,并利用多个智能体协同工作,分别负责生成候选修复方案、剪枝无效方案和选择最佳方案。这种模块化的设计能够更好地探索解空间,并有效利用代码仓库的信息。

技术框架:Trae Agent包含三个主要模块:生成代理(Generation Agent)、剪枝代理(Pruning Agent)和选择代理(Selection Agent)。生成代理负责生成多个候选修复方案;剪枝代理评估这些方案,去除明显错误的方案;选择代理则从剩余方案中选择最佳方案。整个流程迭代进行,直到找到满意的修复方案。

关键创新:Trae Agent的关键创新在于其基于代理的集成推理框架。与传统的基于提示的方法相比,Trae Agent能够更有效地探索大型集成空间,并利用代码仓库的上下文信息。此外,模块化的设计使得各个代理可以独立优化,从而提高整体性能。

关键设计:Trae Agent的具体实现细节包括:生成代理使用多种提示策略生成候选方案;剪枝代理使用静态分析和测试用例来评估方案的正确性;选择代理使用强化学习或排序模型来选择最佳方案。具体的参数设置和网络结构取决于所使用的LLM和具体的任务。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

Trae Agent 在 SWE-bench 基准测试中取得了显著成果,Pass@1 指标达到 75.20%,超越了所有现有方法,并在 SWE-bench Verified 排行榜上名列第一。相较于其他集成推理技术,Trae Agent 平均提升了 10.22% 的 Pass@1 分数,证明了其在代码缺陷修复方面的优越性能。

🎯 应用场景

Trae Agent 可应用于自动化代码修复、代码缺陷检测、软件质量保证等领域。通过自动修复代码缺陷,可以显著提高软件开发效率,降低维护成本。该研究成果对于提升软件工程自动化水平具有重要意义,并有望推动软件开发模式的变革。

📄 摘要(原文)

Software issue resolution is a critical challenge in software engineering and has garnered increasing attention in recent years. With the rapid advancement of large language models (LLMs), substantial progress has been made in addressing real-world software engineering tasks. Recent studies have introduced ensemble reasoning techniques to enhance the performance of LLM-based issue resolution. However, existing prompting-based methods still face limitations in effectively exploring large ensemble spaces and lack the capacity for repository-level understanding, both of which constrain their overall effectiveness. In this paper, we propose Trae Agent, the first agent-based ensemble reasoning approach for repository-level issue resolution. Trae Agent formulates our goal as an optimal solution search problem and addresses two key challenges, i.e., large ensemble spaces and repository-level understanding, through modular agents for generation, pruning, and selection. We conduct extensive experiments using three leading LLMs on the widely-adopted SWE-bench benchmark, comparing Trae Agent against four state-of-the-art ensemble reasoning techniques. Experimental results demonstrate that Trae Agent consistently achieves superior performance, with an average improvement of 10.22% over all baselines in terms of Pass@1. Trae Agent has achieved first place on the SWE-bench Verified leaderboard, with a notable Pass@1 score of 75.20%. We are pleased to release Trae Agent as an open-source project to support the research community, with all resources available at https://github.com/bytedance/trae-agent.