The model asks. Your code is the one that acts — the tool call, the gap, and who executes it
It does not: the model emits a structured request naming a tool and its arguments and then stops, and every consequence — the lookup, the money, the record of it — happens in your code afterwards, in the gap between the model's output and the tool.
A schema fixes the shape of a reply, never the truth of the values inside it — but a shape your code can parse is still worth having. Now that object arrives asking for a refund. Who actually moves the money?
Scene 05
The model asks. Your code is the one that acts
- Watch
- Try it
- Predict
- Capture
How does a model that only writes text look up an order or move money? It does not — not directly, and that is the whole scene. The order-status ticket from the support desk is back: "where is order #48213?" Watch two beats. First, what comes out of the model is not an answer: it is an amber chip naming one tool and its arguments, and it stops dead at the wall running down the middle of your program. Then your code passes it through the notch, the line reaches lookup_order, and what the tool returned comes back across the wall and lands on the window bar as a new message. Watch which side of that wall each beat happens on.
Where this sits in Build a production AI agent (from one API call up)
Scene 05 of 2, in the Tools & loop act — The model asks, your code acts, and then it loops.. A tool call is a message the model emits before it stops; your code decides whether to run it, runs it, and appends the result — so until your code acts, nothing has happened anywhere.
Up next. One request, one tool run, one result. Who decides whether there is a next step?
All 2 scenes in Build a production AI agent (from one API call up) · Every curriculum