エージェントによるエージェントのための効果的なツール作成
エージェントの効果性は与えられるツールに依存する。高品質なツールと評価方法を共有し、Claudeを用いてツールを自己最適化することで性能向上が可能である。
キーポイント
エージェントの効果性を最大化するためのツール設計原則を提示
モデルコンテキストプロトコル(MCP)によるツール統合の重要性を強調
Claudeを活用したツール最適化の実践的アプローチを紹介
決定論的システムと非決定論的エージェント間の契約としてのツール設計を提案
包括的評価と反復的改善のプロセスを推奨
影響分析・編集コメントを表示
影響分析
この記事は、AIエージェントの実用性を飛躍的に向上させるツール設計の体系的な方法論を提供しており、エージェント開発の実践的なベストプラクティスを確立する可能性があります。特に、ツールの命名空間設計やトークン効率の最適化など、具体的な技術的指針は業界標準化の基盤となり得ます。
編集コメント
Anthropicが実践するエージェントツール開発のノウハウを公開した貴重な記事。理論と実践のバランスが良く、開発者にとって即活用可能な知見が豊富。
AIエージェントのための効果的なツール作成手法:エージェント自身を活用した最適化
AIエージェントの実用性は、与えられるツールの質に大きく依存する。本記事では、高品質なツールとその評価方法を構築し、さらにClaudeのようなエージェント自身にツールを最適化させることで性能を向上させる手法を紹介する。
ツール設計の根本的な転換:決定論的システムから非決定論的エージェントへ
従来のソフトウェア開発は、同じ入力に対して常に同じ出力を返す「決定論的システム」間の契約を定義していた。しかし、エージェントは非決定論的であり、同じ質問に対してもツール呼び出し、一般知識からの回答、さらには明確化の質問など、多様な応答を生成し得る。時にはツールの使用方法を誤ったり、虚構の応答(ハルシネーション)を生むこともある。したがって、エージェントのためのツール設計では、人間の開発者向けのAPI作成とは異なるアプローチが必要となる。
効果的なツール開発の実践的プロセス
開発は以下の循環的プロセスで進める。
- プロトタイプの構築とローカルテスト:まずは簡易版ツールを迅速に立ち上げ、動作を確認する。
- 包括的評価の実施:エージェントを用いてツールの性能を多角的に測定・評価する。
- エージェントとの協働による改善:Claude Codeなどのエージェントと協力し、評価結果に基づいてツールを改良する。この「評価→改善」のサイクルを繰り返し、実世界のタスクで高い性能を発揮するまで最適化する。
高品質なツール作成のための5つの核心原則
開発過程で明らかになった重要な原則は以下の通りである。
- 実装すべきツールの適切な選択:エージェントが解決すべきタスクの本質に貢献するツールに焦点を当て、必要ないものは実装しない判断が重要である。
- 機能の明確な境界定義のための名前空間(ネームスペーシング):ツール群を論理的にグループ化し、機能の重複や混乱を防ぐ。
- ツールからエージェントへの意味のあるコンテキスト返却:エージェントの次の判断や行動に役立つ、豊富で関連性の高い情報を返すように設計する。
- トークン効率を考慮した応答の最適化:不必要な冗長性を排し、処理コストと速度を考慮した応答形式を心がける。
- ツール記述と仕様のプロンプトエンジニアリング:エージェントがツールの機能、使用方法、適切な利用場面を正確に理解できるよう、説明文と仕様を慎重に設計する。
まとめ
Model Context Protocol (MCP)により、エージェントは数百ものツールを利用可能になるが、その真の可能性を引き出す鍵は、エージェントの非決定論的な性質に適合したツール設計にある。ここで紹介したプロセスと原則に従うことで、エージェントが多様な戦略を通じて広範なタスクを解決できる「有効範囲」を拡
原文を表示
Engineering at AnthropicWriting effective tools for agents — with agents
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 systems1.
We begin by covering how you can:
Build and test prototypes of your tools
Create and run comprehensive evaluations of your tools with agents
Collaborate with agents like Claude Code to automatically increase the performance of your tools
We conclude with key principles for writing high-quality tools we’ve identified along the way:
Choosing the right tools to implement (and not to implement)
Namespacing tools to define clear boundaries in functionality
Returning meaningful context from tools back to agents
Optimizing tool responses for token efficiency
Prompt-engineering tool descriptions and specs
In computing, deterministic systems produce the same output every time given identical inputs, while non-deterministic systems—like agents—can generate varied responses even with the same starting conditions.
When we traditionally write software, we’re establishing a contract between deterministic systems. For instance, a function call like getWeather(“NYC”) will always fetch the weather in New York City in the exact same manner every time it is called.
Tools are a new kind of software which reflects a contract between deterministic systems and non-deterministic agents. When a user asks "Should I bring an umbrella today?,” an agent might call the weather tool, answer from general knowledge, or even ask a clarifying question about location first. Occasionally, an agent might hallucinate or even fail to grasp how to use a tool.
This means fundamentally rethinking our approach when writing software for agents: instead of writing tools and MCP servers the way we’d write functions and APIs for other developers or systems, we need to design them for agents.
Our goal is to increase the surface area over which agents can be effective in solving a wide range of tasks by using tools to pursue a variety of successful strategies. Fortunately, in our experience, the tools that are most “ergonomic” for agents also end up being surprisingly intuitive to grasp as humans.
In this section, we describe how you can collaborate with agents both to write and to improve the tools you give them. Start by standing up a quick prototype of your tools and testing them locally. Next, run a comprehensive evaluation to measure subsequent changes. Working alongside agents, you can repeat the process of evaluating and improving your tools until your agents achieve strong performance on real-world tasks.
It can be difficult to anticipate which tools agents will find ergonomic and which tools they won’t without getting hands-on yourself. Start by standing up a quick prototype of your tools. If you’re using Claude Code to write your tools (potentially in one-shot), it helps to give Claude documentation for any software libraries, APIs, or SDKs (including potentially the MCP SDK) your tools will rely on. LLM-friendly documentation can commonly be found in flat llms.txt files on official documentation sites (here’s our API’s).
Wrapping your tools in a local MCP server or Desktop extension (DXT) will allow you to connect and test your tools in Claude Code or the Claude Desktop app.
To connect your local MCP server to Claude Code, run claude mcp add <name> <command> [args...].
To connect your local MCP server or DXT to the Claude Desktop app, navigate to Settings > Developer or Settings > Extensions, respectively.
Tools can also be passed directly into Anthropic API calls for programmatic testing.
Test the tools yourself to identify any rough edges. Collect feedback from your users to build an intuition around the use-cases and prompts you expect your tools to enable.
Next, you need to measure how well Claude uses your tools by running an evaluation. Start by generating lots of evaluation tasks, grounded in real world uses. We recommend collaborating with an agent to help analyze your results and determine how to improve your tools. See this process end-to-end in our tool evaluation cookbook.
With your early prototype, Claude Code can quickly explore your tools and create dozens of prompt and response pairs. Prompts should be inspired by real-world uses and be based on realistic data sources and services (for example, internal knowledge bases and microservices). We recommend you avoid overly simplistic or superficial “sandbox” environments that don’t stress-test your tools with sufficient complexity. Strong evaluation tasks might require multiple tool calls—potentially dozens.
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み