智能体的效能取决于我们赋予的工具。我们分享如何编写高质量工具和评估方法,以及如何通过让 Claude 自我优化工具来提升性能。模型上下文协议(MCP)可以为 LLM 智能体提供数百个工具来解决实际任务。但如何使这些工具发挥最大效用?在本文中,我们描述了在多种智能体 AI 系统中提升性能的最有效技术。
Agents are only as effective as the tools we give them. We share how to write high-quality tools and evaluations, and how you can boost performance by using Claude to optimize its tools for itself. The Model Context Protocol (MCP) can empower LLM agents with potentially hundreds of tools to solve real-world tasks. But how do we make those tools maximally effective? In this post, we describe our most effective techniques for improving performance in a variety of agentic AI systems 1.
核心贡献 · Key contributions
提出了一种迭代的、评估驱动的流程,使用 Claude Code 等智能体来编写和优化 AI 智能体工具。 Proposes an iterative, evaluation-driven process for writing and optimizing AI agent tools using agents like Claude Code.
介绍了关键原则:选择合适的工具、命名空间化、返回有意义的上下文、优化 Token 效率以及提示工程化描述。 Introduces key principles: choose the right tools, namespace them, return meaningful context, optimize token efficiency, and prompt-engineer descriptions.
演示了将多个 API 调用合并为单一工具(例如 schedule_event)可提升智能体性能并减少上下文浪费。 Demonstrates that consolidating multiple API calls into single tools (e.g., schedule_event) improves agent performance and reduces context waste.
表明将 UUID 解析为语义名称可显著减少检索任务中的幻觉。 Shows that resolving UUIDs to semantic names significantly reduces hallucinations in retrieval tasks.
建议使用 response_format 枚举控制工具详细程度,在保留必要细节的同时节省 Token。 Recommends using response_format enums to control tool verbosity, saving tokens while retaining necessary detail.
强调工具描述的小改进可带来显著提升,如 Claude Sonnet 3.5 在 SWE-bench 上的表现。 Highlights that small refinements to tool descriptions can yield dramatic improvements, as seen with Claude Sonnet 3.5 on SWE-bench.
局限 · Limitations
评估驱动的方法需要大量前期工作来创建现实任务和验证器。 The evaluation-driven approach requires significant upfront effort to create realistic tasks and verifiers.
最佳工具设计可能因不同 LLM 和任务而异,需要定制化评估。 Optimal tool design may vary across different LLMs and tasks, requiring custom evaluations.
这些原则来自 Claude 的经验,可能不适用于所有智能体架构。 The principles are derived from experience with Claude and may not generalize to all agent architectures.
合并工具可能减少对未覆盖边缘情况的灵活性。 Consolidating tools may reduce flexibility for edge cases not covered by the consolidated design.
该方法假设智能体能有效使用思维链推理,这对较弱模型可能不成立。 The approach assumes agents can effectively use chain-of-thought reasoning, which may not hold for weaker models.
论文章节 · Sections(共 13)
为智能体编写高效工具——借助智能体Writing effective tools for agents — with agents
什么是工具?What is a tool?
如何编写工具How to write tools
构建原型Building a prototype
运行评估Running an evaluation
与智能体协作Collaborating with agents
编写有效工具的原则Principles for writing effective tools
为智能体选择合适的工具Choosing the right tools for agents
工具命名空间Namespacing your tools
从工具中返回有意义的上下文Returning meaningful context from your tools
优化工具响应的词元效率Optimizing tool responses for token efficiency
通过提示工程优化工具描述Prompt-engineering your tool descriptions