Letting a model call functions with structured arguments.
Made for you now: slide lessons from basics to production, usually with code and a quiz. See a finished one
You describe functions to the model with a name, a purpose and a JSON schema for arguments. Instead of answering in prose, the model can return a structured request: call this function with these arguments.
The model never executes anything. Your application validates the arguments, runs the function, and sends the result back as a new message. The model then continues with that result.
Validate every argument against the schema. Give tools the least privilege they need, require confirmation for irreversible actions, and treat tool output as untrusted data, since it can contain instructions an attacker wrote.
Step 1
Prompt + tool schemas
Model sees what functions exist.
Step 2
Model returns a call
Tool name and JSON arguments.
Step 3
App validates + runs
Schema check, permissions, execution.
Step 4
Result appended
Tool output goes back as a message.
↺ Repeat until the model answers without a tool call