# Designing Tools for Agents

> The quality of an agent is mostly the quality of its tools: naming, granularity, outputs, errors and permissions. Free notes, key concepts, resources and a...

Canonical: https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-tool-design
Last updated: 2026-11-28

The quality of an agent is mostly the quality of its tools: naming, granularity, outputs, errors and permissions.

Intermediate · about 5 hours · difficulty 3/5

Learn first: [The Agent Loop](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-loop)

When an agent misbehaves, the cause is usually a confusing tool rather than a weak model. Think of tools as an **interface designed for a new colleague** who reads only the names and descriptions you give them.

### Principles

- **Right granularity**: prefer a few purposeful tools (`search_orders`, `refund_order`) over thin wrappers around every API endpoint. Each extra tool is another choice the model can get wrong.
- **Descriptive names and docs**: say what the tool does, when to use it, when not to, and what each parameter means with examples.
- **Token-efficient outputs**: return the fields the model needs, paginate large results and offer a concise and a detailed mode. Truncate with a clear note rather than silently.
- **Actionable errors**: "No order found with id 123. Use search_orders to find the id by email" beats a stack trace.
- **Idempotency**: agents retry. Make write operations safe to repeat or detect duplicates.

### Permissions and risk tiers

Classify tools by blast radius. **Read** tools can usually run freely. **Write** tools need validation and authorization against the real user. **Irreversible or costly** tools (payments, emails, deletes) should require human confirmation. Enforce all of this in code, never only in the prompt.

### Testing tools

Write evals that give the agent realistic tasks and check which tools it picks and with what arguments. Watch for tools it never uses (bad description) or overuses (too broad).

### Good enough to move on

You can take a raw REST API and design a small tool set for it, with schemas, examples, truncated outputs and risk tiers, and show with a few test tasks that the agent picks them correctly.

## Key concepts

- **Tool granularity and consolidation**
- **Names, descriptions and examples**
- **Concise outputs and pagination**
- **Actionable error messages**
- **Idempotent write tools**
- **Risk tiers and confirmations**
- **Tool selection evals**

## Mini project

Wrap a public API (for example a weather or books API) as three agent tools, then write 15 test tasks and measure how often the agent picks the correct tool with valid arguments, iterating on descriptions until it passes.

## Check yourself

Why is returning a 5,000 row JSON dump from a tool harmful even when the context window can hold it?

## Free resources

- [Anthropic: Writing effective tools for agents](https://www.anthropic.com/engineering/writing-tools-for-agents) (Anthropic)
- [Anthropic docs: tool use](https://docs.anthropic.com/en/docs/build-with-claude/tool-use/overview) (Anthropic)

Previous: [The Agent Loop](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-loop) · Next: [Planning, Reflection and Long Tasks](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-planning)

## More in Building AI Agents

- [The Agent Loop](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-loop)
- [Designing Tools for Agents](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-tool-design)
- [Planning, Reflection and Long Tasks](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-planning)
- [Memory and Context Engineering](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-memory)
- [Model Context Protocol (MCP)](https://www.internhack.in/roadmaps/tracks/ai-engineer/mcp)
- [Agent SDKs and Frameworks](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-frameworks)
- [Multi-Agent Systems](https://www.internhack.in/roadmaps/tracks/ai-engineer/multi-agent-systems)
- [Computer Use and Browser Agents](https://www.internhack.in/roadmaps/tracks/ai-engineer/computer-use-agents)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [AI Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/ai-engineer)
