AI engineering · 24 of 42

Tool Calling

The model asks; your code does it

Scroll

The model asks; your code does it

Given a description of the tools available, a model can respond with a structured request to use one: a name and some arguments, as JSON.

It does not execute anything. Your code receives that request, decides whether to honor it, runs it, and feeds the result back into the conversation as another message.

That boundary is the whole security model, and it is easy to lose sight of once a framework is doing the plumbing. The model proposes; your code disposes. Every question about what an agent is permitted to do is answered on your side of that line, not by anything in the prompt.

Interface
THE MODEL ASKS; YOUR CODE DOES IT the model tool schemas names, arguments get_order(id=4102) a request, not an action — just JSON your code runs it result goes back in as another message The model never touches your systems. It emits a structured request, and everything about whether that request is allowed is your decision.
A model emitting a structured call, application code executing it, and the result returning as another message.