arXiv:2503.04479cs.AIcs.SE2025-03被引 18

自动检测AI代理工具文档缺陷,提升智能体可靠性。

ToolFuzz -- Automated Agent Tool Testing

  • 用自然语言生成测试用例,自动发现工具文档中的错误
  • 在32个常用工具上比提示工程多发现20倍错误输入
  • 适合开发智能体时验证工具文档完整性,尤其关注细节缺失

大型语言模型(LLM)代理在现实应用中依赖工具(如网页搜索或数据库API)与环境交互。由于代理需根据用户查询和工具文档进行推理,文档的完整性和正确性至关重要。然而,工具文档常存在过度、不足或不明确说明的问题,影响代理准确性。传统软件测试方法难以识别这些以自然语言表达的错误。目前尚无自动化方法用于测试代理工具文档。为此,我们提出ToolFuzz,首个自动化工具文档测试方法。ToolFuzz旨在发现两类错误:(1) 导致工具运行时错误的用户查询;(2) 导致代理响应错误的用户查询。它能生成大量多样化的自然语言输入,在低误报率下有效发现文档缺陷。此外,我们还提出了两种简单的提示工程方法。我们在32个常见LangChain工具及35个新创建的自定义工具上,结合两个新基准进行评估。结果显示,许多公开可用工具存在显著的规格不足问题。具体而言,ToolFuzz发现的错误输入数量是提示工程方法的20倍,表明其对构建可靠AI代理具有关键作用。

原文摘要 · Abstract (English)

Large Language Model (LLM) Agents leverage the advanced reasoning capabilities of LLMs in real-world applications. To interface with an environment, these agents often rely on tools, such as web search or database APIs. As the agent provides the LLM with tool documentation along the user query, the completeness and correctness of this documentation is critical. However, tool documentation is often over-, under-, or ill-specified, impeding the agent's accuracy. Standard software testing approaches struggle to identify these errors as they are expressed in natural language. Thus, despite its importance, there currently exists no automated method to test the tool documentation for agents. To address this issue, we present ToolFuzz, the first method for automated testing of tool documentations. ToolFuzz is designed to discover two types of errors: (1) user queries leading to tool runtime errors and (2) user queries that lead to incorrect agent responses. ToolFuzz can generate a large and diverse set of natural inputs, effectively finding tool description errors at a low false positive rate. Further, we present two straightforward prompt-engineering approaches. We evaluate all three tool testing approaches on 32 common LangChain tools and 35 newly created custom tools and 2 novel benchmarks to further strengthen the assessment. We find that many publicly available tools suffer from underspecification. Specifically, we show that ToolFuzz identifies 20x more erroneous inputs compared to the prompt-engineering approaches, making it a key component for building reliable AI agents.

AI代理工具测试文档验证自动化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。