Designing Tools a Model Calls Well

Function calling as API design: JSON Schema definitions, names and descriptions, granularity, actionable errors, idempotency, parallel calls, result size and pagination, the tool-use loop, and selection evals.

Overview

Why this topic

When an agent fails, the model is rarely the first thing to fix. The usual cause is a tool: a vague description, two tools that overlap, an error message that says only 500, or a result so large it pushes the task out of context. Tool design is API design for a caller that reads every word of your docs on every request and cannot ask a follow-up question.

Interview questions

  • Write the tool-use loop for an agent. What does each step guard against?
  • Your agent has 40 tools and keeps choosing the wrong one. How do you fix it?
  • Design the error contract for your tools. What goes in an error result?
  • How do you make tools with side effects safe to call from an agent?
  • When should a model make parallel tool calls, and what can go wrong?
  • A tool returns a 2 MB JSON document. What do you do?

Sign up free to read the full topic

More Agentic AI topics

Start free on Cariara · Coding problems · System design studio