Let a model call your functions with typed arguments, safely.
Starting with How tool calling works, Tools, Writing tool schemas, The tool loop, Handling tool errors, Side effects and confirmation, and more
In a picture
Tell the model which tools exist and what arguments they take.
The model replies with a tool call instead of text.
Your code runs the tool; the model writes the final answer.
Stage 1 of 3: Describe
Open the full conceptMade for you now: slide lessons from basics to production, usually with code and a quiz. See a finished one
Let a model call your functions with typed arguments, safely.
AI EngineeringStage 10 of 17: Tool calling
Start with these 6. 9 more are one tap away.
The model returns a function name and arguments; your code runs it.
Letting a model call functions with structured arguments.
Names, descriptions and JSON Schema parameters a model can follow.
Call, run, return the result, and repeat until the model answers.
Validate arguments, retry and fall back.
Ask the user before tools that send, pay or delete.