When an AI agent calls the wrong tool, passes an argument it could not possibly know, or loops after an error it cannot interpret, the instinct is to blame the model. Usually the model is innocent. The failure was written earlier, by whoever defined the tool.
A tool is the only way an agent touches the world, and a tool definition is a contract with three signatories: the model, which must understand when to call it and how to fill its arguments; the harness — the code around the model — which must validate and execute it; and the future reader of the trace, who must be able to tell what happened. Design the contract well and the model's job becomes small and checkable. Design it carelessly and no model, however strong, can call your system reliably. It will be guessing at a contract nobody actually wrote.
One tool, one job, one sentence
Begin with the name and the one-sentence job. A tool does one thing, and its name says that thing in the vocabulary of the task: get_job_history, draft_reply, route_ticket.
The failure shapes are familiar. A tool named handle_ticket that classifies, retrieves, drafts, and routes depending on a mode argument is four contracts wearing one coat; the model must guess which pocket the arguments belong in. A tool named search that sometimes reads a database, sometimes the web, and sometimes a document store returns three different shapes and teaches the model nothing stable about any of them.
Split until each tool's job fits its one sentence without the word "and" doing structural work. The model chooses among clear tools far more reliably than it configures a vague one — and your trace becomes readable for free, because a run's tool list is its table of contents.
Arguments the model can actually know
Next, the arguments. Every argument must be something the model can actually know at the moment of the call — from the goal, from context, or from a previous observation — and the schema must say so in its types, its required fields, and its stated ranges.
Picture a history tool for a support agent. It takes an account_id — a string, required, because the ticket names the account — and a limit: an integer, optional, from 1 to 20, defaulting to 5, most recent jobs first. On success it returns a list of jobs, each with an identifier, a date, and a summary, plus a count that must equal the list's length — a small built-in check the harness can verify before the result ever reaches the model.
Trace it by hand and the discipline shows. The model can fill the account because the ticket supplies it. It can set the limit or accept the default. Nothing in the contract asks it to invent a date range, a technician's name, or a free-text query it has no source for. Tools fail in production precisely at the arguments nobody traced: fields the model must hallucinate to complete the call, which it then does — fluently, plausibly, and wrong.
Errors are part of the contract
Failure belongs in the contract too, with named errors the model can reason about. If the history tool can fail in two ways — the account does not exist, or the history store is unavailable — those are different situations demanding different behavior. The first means stop and escalate, because the ticket's premise is wrong. The second may mean retry once, or draft the reply without history, as the design decides — in advance, in writing, not improvised by the model in the middle of the night.
Compare that with "Error 500," which gives the model nothing. A named error with a stated next move converts failure into behavior you designed. An apology converts it into a retry loop.
Four further clauses complete a keepable contract. Side effects are declared: a read and a write are different species, because reads can be retried freely while writes change the world — so the contract states what a write changes, whether it can be undone, and whether it needs approval. Results are sized for the model: return what the next decision needs, not the database row's autobiography, because forty full records bury the one relevant one and spend the context budget doing it. Validation lives in the harness, always: types, ranges, and permission checks run in your code before execution, whatever the model proposed. A schema shown to the model is documentation; the same schema enforced in the harness is a contract. Only the second kind keeps.
Keep the set small
Finally, keep the tool set itself under discipline. Every tool you offer is a choice the model must make correctly on every turn, and a contract you must maintain. A working triage assistant can ship with a deliberately small set — read the ticket, read job history, read the known-answer store, draft a reply, route to a queue, escalate to a human — and each addition should have to argue its way in against one question: could an existing tool's contract, honestly widened, do this job? Usually it could.
This is where the common instinct — give the agent plenty of powerful tools, and let a strong model figure out when to use each one — gets the arithmetic backwards. Every added tool multiplies the ways a run can go wrong: one more choice to get wrong per turn, one more argument set to fill from insufficient knowledge, one more side effect to govern. Strong models do not repeal that arithmetic. They merely fail more fluently inside it.
Usefulness comes from a small set of contracts the model can keep every time, widened only when a real task proves the set too narrow. Capability added by contract, not by the armful — that is the whole secret, and it is a design discipline, not a model feature.
Experience it, don’t just read about it
A tool definition as a contract the model can actually keep — one job, knowable arguments, named errors, enforced validation — is Concept 3 of AI Agent Development (Course No. 202), from Cognosco Learning, a learning company powered by AI. The course builds the wider agent-building practice beyond this distinction — Planning and Control Loops, Human Control, and Evaluating Behavior — each worked through with an Agentic Socratic AI coach, one learner at a time. Try a Free Preview at cognoscolearning.com.
Navigate your own course.
© 2026 Cognosco Learning. All rights reserved.