- Archived full text: Full archived text, with credits
- Link: https://www.anthropic.com/research/writing-tools-for-agents
What it says
Anthropic describes how to build, evaluate, and improve tools for LLM agents. Tools are contracts between deterministic systems and non-deterministic agents, so they need to be designed for agents, not wrapped from APIs. The process is iterative: stand up a quick prototype, generate dozens of grounded evaluation tasks (often requiring many tool calls), run them programmatically with simple while-loops, analyze transcripts and metrics, then refine tools with an agent. Key principles: build few consolidated tools instead of many overlapping ones, namespace tools by service and resource, return only high-signal context (names over UUIDs), tune response length and structure, and prompt-engineer tool descriptions and error messages, because small description refinements can dramatically move performance. Held-out test sets prevent overfitting to the training evaluations.
Claims drawn from this source
- Tools are contracts between deterministic systems and non-deterministic agents. Unlike deterministic software functions, tools reflect a contract between deterministic systems and non-deterministic agents; an agent may call the tool, answer from general knowledge, ask a clarifying question, or hallucinate.
- Evaluation should generate many grounded tasks with verifiable outcomes. Evaluators should create dozens of prompts inspired by real-world uses, based on realistic data sources, potentially requiring dozens of tool calls, each paired with a verifiable response or outcome.
- Track metrics beyond top-level accuracy. Beyond accuracy, collect total runtime of individual tool calls and tasks, total number of tool calls, total token consumption, and tool errors, because tracking tool calls reveals common workflows and opportunities for consolidation.
- Few, consolidated tools beat many overlapping ones. Tools that merely wrap existing software functionality are often wrong for agents because agents have limited context; better to build schedule_event, search_logs, and get_customer_context instead of list_users/list_events/create_event, read_logs, or get_customer_by_id/list_transactions/list_notes.
- Namespacing with services and resources clarifies boundaries. Grouping related tools under common prefixes (asana_search, jira_search, asana_projects_search, asana_users_search) delineates boundaries so agents pick the right tool; prefix- versus suffix-based schemes have non-trivial effects that vary by LLM.
- Responses should return meaningful, token-efficient context. Return only high-signal fields (name, image_url), prefer natural-language identifiers over UUIDs and mime_type, expose a response_format enum for concise or detailed answers, paginate or filter responses, and cap tool responses (e.g. 25,000 tokens by default).
- Prompt-engineer tool descriptions and errors. Tool descriptions are loaded into the agent’s context and steer behavior; small refinements led Claude Sonnet 3.5 to SOTA on SWE-bench Verified, and errors should be actionable, not opaque codes or tracebacks.
- Held-out test sets avoid overfitting to training evaluations. The team relied on held-out test sets, which revealed additional performance improvements even beyond expert tool implementations, whether manually written or generated by Claude.