LLM-based agents are rapidly being adopted across diverse domains. Since they interact with users without supervision, they must be tested extensively. Current testing approaches focus on acceptance-level evaluation from the user's perspective. While intuitive, these tests require manual evaluation, are difficult to automate, do not facilitate root cause analysis, and incur expensive test environments. In this paper, we present methods to enable structural testing of LLM-based agents. Our approach utilizes traces (based on OpenTelemetry) to capture agent trajectories, employs mocking to enforce reproducible LLM behavior, and adds assertions to automate test verification. This enables testing agent components and interactions at a deeper technical level within automated workflows. We demonstrate how structural testing enables the adaptation of software engineering best practices to agents, including the test automation pyramid, regression testing, test-driven development, and multi-language testing. In representative case studies, we demonstrate automated execution and faster root-cause analysis. Collectively, these methods reduce testing costs and improve agent quality through higher coverage, reusability, and earlier defect detection. We provide an open source reference implementation on GitHub.


翻译:基于大型语言模型(LLM)的智能体正迅速应用于各个领域。由于它们在没有监督的情况下与用户交互,因此必须进行广泛测试。当前的测试方法主要关注从用户视角进行的验收级评估。这类测试虽然直观,但需要人工评估、难以自动化、不利于根因分析,且测试环境成本高昂。本文提出了实现基于LLM的智能体结构测试的方法。我们的方法利用基于OpenTelemetry的追踪记录智能体执行轨迹,采用模拟技术确保LLM行为的可复现性,并通过断言机制实现测试验证自动化。这使得在自动化工作流中能够从更深技术层面测试智能体组件及其交互。我们展示了结构测试如何使软件工程最佳实践适用于智能体,包括测试自动化金字塔、回归测试、测试驱动开发以及多语言测试。通过代表性案例研究,我们验证了自动化执行与更快速的根因分析能力。总体而言,这些方法通过更高的测试覆盖率、可复用性和早期缺陷检测,降低了测试成本并提升了智能体质量。我们在GitHub上提供了开源参考实现。

0
下载
关闭预览

相关内容

机器或装置在无人干预的情况下按规定的程序或指令自动进行操作或控制的过程, 是一门涉及学科较多、应用广泛的综合性科学技术。
LLM/智能体作为数据分析师:综述
专知会员服务
36+阅读 · 2025年9月30日
大语言模型智能体的评估与基准:综述
专知会员服务
46+阅读 · 2025年7月31日
LLMs与生成式智能体模拟:复杂系统研究的新范式
专知会员服务
27+阅读 · 2025年6月15日
可信赖LLM智能体的研究综述:威胁与应对措施
专知会员服务
36+阅读 · 2025年3月17日
智能合约的形式化验证方法研究综述
专知
16+阅读 · 2021年5月8日
【综述】多智能体强化学习算法理论研究
深度强化学习实验室
15+阅读 · 2020年9月9日
多智能体强化学习(MARL)近年研究概览
PaperWeekly
38+阅读 · 2020年3月15日
爱奇艺基于AI的移动端自动化测试框架的设计
前端之巅
18+阅读 · 2019年2月27日
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
6+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
28+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关基金
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
6+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
28+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员