Stage 2 of 10 · 7 lessons · ~2 weeks
Tool calling from scratch
Build the agent loop yourself with one provider API and no framework: define tools, read tool calls, return results and errors, handle parallel calls, then read a second provider to see what is universal.
Start: Defining toolsLessons· one lesson for each topic, in this order
Do this
- Get an API key from one provider and set a monthly spending limit.
- Define three tools with clear names, descriptions and schemas.
- Write the loop with the official SDK and print every call and result.
- Return error results for a missing record and a timeout, and watch the model recover.
- Trigger a turn with parallel calls and return all results in one message.
- Add a step limit and test that it stops a looping run.
- Read a second provider's tool-calling guide and write down the field mapping.
Start with· follow one of these
- GuideFreeClaude Tool Use Documentation
Anthropic · Intermediate
Read Overview, Define tools and Handle tool calls, then follow the tutorial that grows one call into a full loop
- GuideFreeOpenAI Function Calling Guide
OpenAI · Intermediate
The same loop on the Responses API: read it after your first provider to see what is universal
Practise
Keep handy
Also worth your time
Before moving on: A framework-free agent in your language with three real tools, error results the model can act on, parallel call handling, a step limit and a printed trace of every call, plus a note mapping it to a second provider's API.

Do this stage even if you plan to use a framework. Fifty lines of your own loop will teach you more about agents than a week of framework tutorials. If you want a compact reference while you work, Sefism's LLM APIs cheat sheet at /cheatsheets/llm-apis/ covers the request shapes across providers; this stage goes further into the loop itself.