Tool use lets a model call functions, programs and services instead of only writing text. The model writes a request in a fixed format, the software around it runs the tool and hands back the result, and the model continues. It is how a model gets fresh facts and changes things outside itself.
An analogy
A diner ordering through a waiter. The diner cannot walk into the kitchen; they name a dish from the menu, the waiter carries the order through the door and comes back with a plate. What can be had is exactly what the menu lists and the kitchen will cook.
Tool use is a model asking for a function by name instead of only writing text. The developer defines each tool with a description, an input schema and code to run; the model reads the definitions and writes a call (a name and arguments); the harness checks the arguments, runs the tool and puts the result back in the model's turn, and the loop goes on until the goal is met. The sources show where it goes wrong: arguments that do not fit the schema, calls that come back unchanged, huge results, and results that never arrive.
Definition and call
A function becomes a tool when it is described to the model: a name, a description and an input schema, sent with the request. The model reads these and the user's request and writes a call. It does not run anything. The definition is written for the model, so wording and types are prompt design, and the number of definitions in a request has a cost.
The press prints the function as a definition: a name, a description and an input schema.
At the slip desk the model reads the definition and the request and writes a call: a name and arguments.
127,000 tokens
Tokens that 741 tool definitions (names, descriptions, JSON schemas) take in every request, before the user question; a talk about a large catalog Sohail Shaikh
13.6%
Tool-selection accuracy when all 741 definitions are in the prompt (about 40% near 100 tools, 78% at 10); a router stays above 83%; benchmark reported by the talk Sohail Shaikh
about 1,000 tokens
Tokens when a router injects only the 3 to 5 relevant schemas: about a 99% cut in tool context tokens, as the talk reports Ankush Rastogi
A tool has three parts in the AI SDK: a description the model uses to decide whether and how to use it, an input schema, and an execute function that runs each time the agent uses it. Nico Albanese
A function is sent to the model as a full JSON Schema; choosing its types, descriptions and parameter names is prompt engineering, because the model decides how to call it from all of that. Pamela Fox
Models are trained to read one or more function definitions and the user input and return which function to call with which arguments. Pamela Fox
Check and run
Between the call and the tool stands the harness. It checks that the arguments fit the schema, runs the tool and may run independent calls together. The sources are most concrete about what goes wrong here: a call that fails the check comes back unchanged, newer models invent fields, and a call can end with no result.
The argument gate checks the call against the schema and sends back what does not fit, with the error.
The stockroom hatch runs the tool; independent calls in one turn can run at once, and the call needs an ending.
56 repeats
Times a model repeated the same schema-failing tool call after the validation error came back, on average, in a billion tokens (a coding-agent team, one open model) Latent Space
50+ failures per session
Tool-call failures per session that a harness repair avoids, on average, as the guest says of open models Latent Space
16,000 repair variations
Repair variations the team now keeps, across hundreds of billions of tokens and several open models Latent Space
43 identical calls
Identical tool calls in one turn that a status of ok hides, an example of a bug that no error shows Fuad Ali
To judge one call, check that it picked the right tool and passed the expected arguments; a single call can be tested by comparing the tool name and arguments with the expected values. Pamela Fox
Many models support parallel tool calling: given several definitions they can suggest several calls in the same turn, and the server can send independent requests at the same time. Pamela Fox
In a travel demo, one model searched flights and hotels together in its first turn; the others did not parallelize, and one took two extra calls and more time (a workshop run, not a benchmark). Pamela Fox
When it breaksThe same bad call, again and again. A tool had optional arguments; one open model sent an empty object or null where none belongs. The strict validator sent back its error, and the model got back the same result and sent the same call again; on average 56 repeats in a billion tokens. Latent Space
Open questionWhen a call arrives with wrong arguments, where is the fix: in the tool description or in the harness?
Wrong arguments mean the description is ambiguous: go back to it, say exactly what is wanted, and test again. Pamela Fox
Do not bounce the error: repair the call in the harness with deterministic rules and send back the result with a hint. Latent Space
Result back
The tool's output goes back into the model's context, filed under the call's id, and the loop goes on. A big result can flood the context, so it is cut down and the rest kept where the model can search it. A result that says success is only what one component claims.
The receiving scale weighs the result; a heavy one is cut down and the rest kept in a file.
The pigeonholes file the result under the call's id and return it to the model, which writes the next call.
98.7% fewer tokens
Cut in tool-definition tokens, from about 150,000 to about 2,000, that a talk attributes to loading tools on demand over a tool protocol Ankush Rastogi
Large tool results are treated as files: the harness truncates inside the JSON and lets the agent find the rest by writing code, for example with jq. Fuad Ali
The team keeps a pointer to a big result, like a sticky note on the desk saying where the book is and roughly what it holds, rather than the whole book. Fuad Ali
The result of a tool call is fed back into context and the loop continues. Hugging Face
When it breaksThe result that fills the context. A trace-analysis tool returned a big JSON blob. The blob filled the context window, after which the agent could do almost no useful work. Fuad Ali