Tool and function calling
A model can't look up an order, check the weather or send an email. It can only write text. Tool calling is the trick that turns that text into actions, and your code stays in charge of every one.
In this lesson you'll learn to
- Define a tool with a name, a description and an input schema that a model can use well.
- Run the tool-calling loop, from tool_use to tool_result to a final answer, including parallel calls.
- Return tool errors properly and stop runaway loops.
- Treat tool arguments and tool results as untrusted, and gate actions that can't be undone.
Create a free account to open this lesson
It's free. You'll get every free lesson, quizzes that save your progress, daily flashcards and streaks.