The Tool Call Is a Round Trip
A model has never run a tool. When an agent "searches the ticket system", the model wrote a few lines of structured text and stopped; your code read them, decided whether to act, acted, and wrote the outcome back into the model's input. Everything the agent seems to do happens in that gap, and so does most of what goes wrong with it.
Thesis: The model never runs a tool; your code does. The model writes a tool request your harness, the code around the model, may refuse, filled from the window and, where the window is silent, from what it guesses, so a wrong argument is a question about the schema, the description and the context as much as about the model. And whatever the tool returns comes back as text the model reads, so the gate on any action your code runs has to sit in the harness.
From Logits to Response left the model drawing tokens. This last chapter of The Agentic Lifecycle follows the draws that ask for the world outside the window, and closes the loop Anatomy of a Turn opened.
Definitions Are Text in the Input
A tool definition is text in the call: a name, a description and a schema for the arguments. The provider turns the definitions into more text at the top of the model's input, in a format the model was trained on; both Anthropic and OpenAI describe it that way, and Anthropic's adds a few hundred tokens of its own before any definition.
The definitions often come from somewhere else first. A tool server speaking MCP (the Model Context Protocol) lists its tools when the harness asks, the harness puts each one into the call, and the provider turns them into text (The MCP Mental Model covers the protocol). Every connected server adds definitions to every call, which is how the 238-tool call came to be mostly tool definitions.
Written Is Not the Same as Delivered
Between the definitions and instructions a tool server ships and the tokens the model reads sits the host, the part of the harness that talks to tool servers, and hosts cut. They truncate server instructions, load tool definitions only when the agent searches for them, drop attachments past a size and summarise history, each by their own rule and often without telling the author. The only reliable view of what the model read is the call the host actually sent.
For builders: one instructions block that never arrived
In my notes from 2026-08-04: a tool server I built shipped a 10,457-character instructions block telling an agent which of its tools answers which kind of question. The host passed the model the first 2,048 characters, that host's limit at the time (limits differ by host and change between versions), and deferred the tool schemas until the agent searched for them. Most of the map never reached the model. Nothing failed loudly; the agent routed as if most of the map did not exist. Moving the map inside the first 2,048 characters was the fix. I have no before-and-after figure and claim no size for the effect.
How the Model Chooses a Tool
It reads, and it samples. The model calls a tool when your request, read against the tool's description, looks like something that tool does and the answer is not already in the window (Anthropic's description of its default). Deciding to use a tool means the next tokens form a tool request rather than prose: draws from the distribution From Logits to Response describes, with the descriptions in the input. That is why Describe When, Not What could move routing by rewriting descriptions alone.
Most APIs can also force the model to use a tool. Forcing makes a tool request certain, not right.
Arguments Come From the Window, or From Nowhere
The arguments are sampled too. When the window holds the value, the model copies it; when it does not, the model may ask, or may fill the slot anyway: Anthropic's overview warns that, given a weather tool and no location, the model "might guess values you didn't supply". The practical rule, in OpenAI's words: "Don't make the model fill arguments you already know."
A strict schema narrows the shape. Both large vendors offer a strict mode (Anthropic, OpenAI) that constrains the sampler with a grammar, a rule that blocks any token that would break the schema, so every tool request matches it. Neither guarantees the value. A ticket number of the right pattern that belongs to no ticket passes both. So a wrong argument has four possible owners, and only one is the model.
| Layer | What it can fix | What it cannot |
|---|---|---|
| The description | whether and when the tool is called | which values go in |
| A strict schema | the shape of every argument | whether the value is true |
| The window | the values, when they are in it | anything nobody put there |
| The harness | whether the tool runs at all | whether the model tries again |
The Harness Validates, Runs and Returns
The response arrives with stop_reason: "tool_use" and a block naming the tool and its input. Your harness checks the arguments, decides whether the tool may run, runs it or not, and sends a tool_result back on the next call. The rule for every outcome is the same (Anthropic's handling page): a failure goes back as a result marked as an error, and so does a tool request you chose not to run, with a short reason. One response can also ask for several tools at once, in no set order. Every branch ends the same way: text labelled as a result goes back into the window, and the model is called again. From inside the window a real result, a failed one and a fabricated one are the same kind of thing.
One round trip, with the harness's gate in it:
Step 1 of 6
The request arrives
The user asks to close the printer ticket, but no search has run, so no ticket id is in the window.
Read this figure as text
The wrong ticket
- The request arrives The user asks to close the printer ticket, but no search has run, so no ticket id is in the window.
- The model writes a tool request With no id to copy, the model fills the slot with one of the right shape. Strict mode lets it through: it fixes the shape, not the value.
- The harness checks it Your harness runs its checks on the arguments and the permission, and the request goes on to the tool.
- The tool runs The tool runs with the guessed id and closes the wrong ticket.
- The result goes back The result goes back into the window as text. To the model it looks like any other result.
- The fix sits in the harness A harness rule would have stopped it at the gate: close_ticket takes only ids that search_tickets returned earlier in the same request. The refusal would have gone back as an error.
Refused
- The permission check says no Here the harness refuses a request at the permission check. For a tool your code runs, that gate is yours.
- A result still goes back The tool never runs, but a result still goes back to the model, marked as an error, with a short reason.
An error
- The tool runs Both checks pass, and your code runs the tool. The model never runs it.
- The tool fails The tool fails and hands an error back to your harness.
- The model is called again The labelled error goes back into the window, and the model is called again.
An empty result
- The error is swallowed The ticket API fails, but the harness swallows the error and sends back an empty result with no error flag.
- The model reports an empty queue The model reads the empty result as an empty queue and reports no open priority-1 tickets.
- The fix: label the failure The fix is in the harness: send the failure back as a labelled error, never as nothing.
The fence
- the call: tool definitions, history, the user's message
- a tool_use block, stop reason tool_use
- the harness validates the arguments and checks the permission
- if valid and permitted: run the tool
- the output, or an error
- refused or failed: the result says so, is_error true
- a tool_result, the output or the error, call again
- the answer, stop reason end_turn
The tickets are invented.
Figure: The tool round trip. The model returns a tool_use request; the harness validates the arguments and checks the permission, runs the tool or records why not, and sends the output or the error back as a tool_result before the model answers.
Client Tools and Server Tools
The line is where the code runs. A client tool runs in your application, through the round trip above. A server tool, such as a provider's web search, runs on the provider's machines inside the same call, and you see only its results (Anthropic and OpenAI both offer them).
What matters is where the gate is. For a client tool the gate is yours: a validation, a permission, a human. For a server tool it is the provider's, such as a list of allowed domains or a cap on uses, and the record you get is the response. No check of yours runs before that tool does.
Prompt Injection Is the Same Mechanism
A tool result is text in the window under a role the model was trained to distrust, which is a disposition, not a wall (How the Model Reads the Window shows why). So text in a result that addresses the model can steer it, and the wall has to be the harness: give each tool the least access its job needs, require approval before a write, and put hard denials in a permission check that runs before the tool, which refuses the tool request unless it can confirm it is allowed. Prompt Injection Is a Design Problem takes that design further.
Three Incidents at a Service Desk
Take the service-desk agent from Anatomy of a Turn and give it a second tool, close_ticket(ticket_id, resolution). The tickets are invented.
The agent closed the wrong ticket. The user said "close the printer one"; no search had run in this request, so no ticket id was in the window. The model filled the slot with an id of the right shape, and strict mode passed it. The owner is the window, and the gate that would have caught it is a harness rule: close_ticket accepts only ids returned by search_tickets earlier in this request.
The agent said there were no open priority-1 tickets. The ticket API returned a server error; the harness swallowed it and returned an empty result with no error flag. The model read an empty result as an empty queue. The owner is the harness: a failure goes back as a labelled error, never as nothing.
A ticket body contained text addressed to the agent. The model weighed it as it weighs any text in a result, the trained disposition at work. What stood between the text and the action was the approval step on close_ticket, not the label on the result. The record that settles all three is the tool_use block as written and the tool_result as returned, both yours to keep.
Back Around the Loop
Follow the result one step further and the series closes on itself. The harness appends the tool_result, and any newly retrieved passages, and calls again, re-sending everything, as Anatomy of a Turn showed. The provider tokenizes the larger call; the model reads it, the earlier tool request and result now part of the window; the sampler draws. Either the tokens form another tool request and the round trip repeats, or the end-of-turn token is drawn and the harness shows the answer. That answer is the response the user sees. What survives it is only what your code, or a provider store you chose, keeps; the model holds none of it for the next request.
When the Round Trip Is Plumbing
Most days it is. SDK tool runners run the loop and handle the manual steps above for you. Strict schemas make malformed tool requests rare; a provider-run tool removes a class of bugs with the code.
It stops being plumbing in three places: when a tool writes, when an argument is wrong and someone must say why, and when a result arrives from a source you do not control. A team that trusts the tool's input and the tool's output equally has put its gate in the one place nothing enforces it.
What to Do Next
- Log the tool request as written and the result as returned. The
tool_useblock and thetool_resultare the part of the audit record that covers every action. - Return every failure as a labelled result. An empty result asserts that nothing was found. Mark errors as errors and a refusal as a refusal.
- Check values against the window, not only the schema. An identifier a write accepts should have appeared in a result earlier in this request.
- Gate writes in the harness. Approval or a hook before the tool runs, and the hard deny in permissions rather than in the prompt.
- Decide which tools the provider runs. For each, know whose gate applies and what record you get back.
This is the last chapter of The Agentic Lifecycle. You can now trace one request through an agent, from the prompt and retrieval through tokens, the window, the cache and sampling to tool calls and back to the response, and say what training fixed in the weights beforehand; One Request, End to End puts all the stages back on one page. What survives a turn is only what your code keeps, so someone has to decide what goes into the window on every call. Next on Start here: Context Engineering, starting with What Context Engineering Means. Related reading: Anatomy of a Turn for the loop this round trip sits in, The MCP Mental Model for where tool definitions come from, MCP Tools Are Not Endpoints and Describe When, Not What for how to shape and describe them, and Confidence Is Not Consent for why the gate carries the weight.
Next on Start here: Context Engineering, chapter 1 of 10: What Context Engineering Means →