Function tools
One decorator turns a plain Python function into a tool the model can ask for. See how the SDK reads the name, the docstring and the type hints, and what happens when the function crashes.
10 minPro
Checking your access…
Inside this lesson
- An animation you play, pause and step through, with each part saying what it is doing.
- The real code beside it, with the lines for each step lit up.
- Practice mode, where you route each message yourself, and a short quiz.
- About 10 minutes.
Written from the official documentation
In this module: Tools
- Function toolsTurning a Python function into a tool.Pro
- Tool arguments, timeouts and errorsField constraints, timeouts, failure messages and image output.Pro
- Hosted toolsWeb search, file search, code interpreter and image generation.Pro
- Tool search and programmatic tool callingLoad tools on demand and let the model script several calls.Pro
- Shell, apply patch and Codex toolsRun commands and edit files locally or in a hosted container.Pro
- Computer useGive an agent a screen, a mouse and a keyboard through your code.Pro