Zero to AI engineer · Stop 8 of 14 lessons
Tool use, from three lines of Python
What this lesson covers
Tool use is the mechanism that turns a language model into the reasoning core of a system. It looks like magic; it’s a loop. This lesson makes the loop concrete.
The outline
- The core idea. A model that can emit
{"tool": "search", "query": "..."}instead of an answer, so you can run the search and give it the result. - Building the loop from scratch. Twenty lines of Python that show exactly what the SDK does — nothing hidden.
- The tool-use API. How Anthropic and OpenAI standardise the same pattern. What changes and what doesn’t.
- Writing schemas models understand. Description quality, argument naming, and the enum trick that eliminates half of tool-call bugs.
- The four common tools. Search, code execution, file IO, HTTP — and the security posture each one demands.
- What tool use is not. The difference between one call with tools and a full agent loop (next lesson).
Coming soon
In outline.