Designing tools for agents (ACI)

In one sentence

Tool names, descriptions, parameters, outputs and errors are prompts the agent reads every call. Expose a few task-shaped tools, return concise results and actionable errors, and tune them on real-task evals.

Analogy: Designing a cockpit, not an API: one clearly labelled control per job, gauges that show only what matters, and levers shaped so the wrong one is hard to grab.

Tools are tuned like prompts: against real tasks, with transcripts and a held-out set, not by intuition.

How it works

  • Don't mirror your REST API 1:1: overlapping tools make the model guess which one fits.
  • Write descriptions like onboarding docs: what it does, when to use it over its neighbour, an example.
  • Make mistakes hard (poka-yoke): enums over free strings, ISO dates with timezone, absolute file paths.
  • Return names, not UUIDs, and only needed fields; paginate by default with a ~10–50 item limit.
  • Fix the tools, not only the prompt: one SRE agent rose from 58% to 79% success.

Check yourself

Answer to mark it learned; your answers aren't scored.

Transcripts show your SRE agent paging through list_tickets 500 rows at a time to find one incident, then passing a ticket title where a UUID is expected. Best tool-level fix?

Go deeper

Full explanation

The agent-computer interface (ACI), a term from SWE-agent (2024), is everything the model sees of a tool: name, description, parameters, outputs, errors. The agent can't read your code or ask a colleague, so each is a prompt. For its SWE-bench agent, Anthropic spent more time optimizing tools than the main prompt.

Principles that survive evals:

  • Few, task-shaped tools. Don't mirror your REST API 1:1: replace list_users + list_events + create_event with schedule_event. Overlap makes the model guess.
  • Descriptions as onboarding docs: what it does, when to use it instead of its neighbour, formats, an example. user_email beats user.
  • Namespacing: jira_search_issues vs slack_search_messages, so servers' search tools don't collide.
  • Poka-yoke parameters: enums over free strings, ISO dates with timezone, absolute file paths (Anthropic's fix for an agent that broke after changing directory).
  • Concise outputs: names over UUIDs, only needed fields, paginated and truncated by default, optionally a response_format: concise|detailed switch.
  • Actionable errors: Unknown service 'paymnts'. Valid: payments, ledger beats a 500 or a stack trace.
  • Easy formats: don't require escaped code inside JSON or exact line counts in diffs.

Then evaluate on realistic multi-step tasks: read transcripts, track success, calls, tokens and errors, and fix the tools, not just the prompt.

Code A task-shaped tool and an agent-friendly output
pythonA task-shaped tool and an agent-friendly output
# One tool per agent TASK (not per endpoint): namespaced, documented, hard to misuse
SCHEDULE = {
    "name": "calendar_schedule_meeting",
    "description": (
        "Find the first slot when ALL attendees are free and book it. "
        "Use this instead of reading calendars one by one. "
        "Returns the booked slot, or the 3 nearest alternatives if none fits."
    ),
    "input_schema": {
        "type": "object",
        "properties": {
            "attendee_emails": {"type": "array", "items": {"type": "string"},
                                "description": "Work emails like ana@acme.com, not names"},
            "duration_min": {"type": "integer", "enum": [15, 30, 45, 60]},
            "not_before": {"type": "string",
                           "description": "ISO 8601 with offset, e.g. 2026-11-10T09:00-05:00"},
        },
        "required": ["attendee_emails", "duration_min", "not_before"],
    },
}

def search_logs(service: str, query: str, limit: int = 20) -> str:
    if service not in SERVICES:  # actionable error, not a stack trace
        return f"Unknown service '{service}'. Valid: {', '.join(sorted(SERVICES))}."
    hits = log_index.search(service, query)
    lines = [f"{h.ts} {h.level} {h.msg[:200]}" for h in hits[:limit]]  # few fields, clipped
    if len(hits) > limit:  # truncate, then tell the agent how to narrow down
        lines.append(f"[{len(hits) - limit} more matches: add a time range or a stricter query]")
    return "\n".join(lines) or "No matches. Try a broader query or check the service name."
Real example

An SRE agent shipped with 34 tools mirroring the internal REST API (get_user, list_tickets, get_ticket_comments…). On 120 replayed incidents it succeeded 58% of the time, averaging 14 calls and ~45K tokens. Transcripts showed it paging through list_tickets 500 rows at a time and passing names where UUIDs were expected. The team merged everything into 7 task-shaped tools (search_tickets(query, status, limit=20), get_incident_context(id)), returned names instead of UUIDs and wrote actionable errors. Same model, same prompt: 79% success, ~5 calls, ~12K tokens.

Trade-offs +3 · −3

+ You gain

  • Often the cheapest quality win in an agent: no model change, no fine-tuning.
  • Fewer calls and smaller outputs cut tokens, latency and context rot together.
  • Good tools transfer: every agent and model that calls them, e.g. via Model Context Protocol (MCP), benefits.

− You pay

  • Task-shaped tools are real engineering: each hides a small workflow you must build and test.
  • Descriptions tuned for one model can regress on another: re-run the eval per model.
  • Consolidation trades flexibility: an unforeseen task may need an operation you merged away.

Use it when

Any time you expose capabilities to a model: building an agent, writing an MCP server, wrapping an internal API. Revisit whenever traces show wrong tool picks, malformed arguments, retries or bloated outputs.

Avoid it when

Don't polish descriptions before you have an eval set of real tasks: without measurements you're tuning by feel. And don't make a tool for a step your code can do deterministically.

Numbers to know 4
  • Claude Code caps tool responses at 25,000 tokens by default (Anthropic, 2025).
  • OpenAI guidance: aim for fewer than ~20 functions available at once, a soft limit for accuracy.
  • SWE-agent (2024): with a purpose-built ACI, GPT-4 Turbo reached 12.5% pass@1 on SWE-bench; ablations showed interface details alone (edit linting, a windowed file viewer) changed the solve rate.
  • Rule of thumb: keep typical tool outputs in the hundreds of tokens, with a default page limit of ~10–50 items.
Common pitfalls 4
  • Mirroring every API endpoint as a tool: the agent chains 3–5 calls and reads raw payloads for one task.
  • Near-duplicate tools (search, find, lookup) with vague descriptions: the model guesses.
  • Returning UUIDs and full JSON blobs: they waste tokens and invite hallucinated ids.
  • Opaque errors (400, a traceback): the agent retries the same call unchanged.
Interview questions 2

Answer out loud first, then reveal.

You're handed an internal REST API with 80 endpoints. How do you expose it to an agent?Show answer

Not 1:1. I collect the 20–30 real tasks users want done, then design tools around those tasks: maybe 8–12, each consolidating several endpoints, namespaced by system. Each gets a description written like onboarding docs, constrained parameters such as enums, ids and ISO dates, concise paginated outputs and actionable errors. Read-only and destructive tools are separate so destructive ones can require confirmation. Then I run the task set as an eval and iterate on the tools from the transcripts.

Your agent picks the wrong tool 20% of the time. How do you debug it?Show answer

I read the failing transcripts and the model's reasoning right before the bad call. Usually two tools overlap, or a description never says when not to use it. Fixes: merge or rename the overlapping pair, add 'use X instead when…' lines, namespace by system, and drop tools this agent doesn't need. I measure selection accuracy per tool on a held-out set so I don't overfit descriptions to the few traces I read, and I re-run it whenever the model version changes.