Start course

Week 1 · Day 3 of 10

Tools: letting the model act

Students can give a model tools, handle what happens when a tool fails, and gate risky actions behind a human.

Robert introduces today: what you'll learn, what you'll build, and why it matters. About two minutes.
In pink: what day 3 adds to the app.
Day 3 adds Tools to the student's app, which already has Your user, FastAPI app, Model, Typed JSON.
1LearnFunction calling with real APIs

How a model decides to call a function, turning Python functions into tool schemas with Pydantic, calling real APIs, handling tool errors, and asking a human to approve risky actions before they run.

How it worksStep 1 of 5

How a tool call works

  1. You ask
The user asks what a £90k salary is in dollars.
Try it liveRuns on a real model

Try it live

Watch a model call real tools

The model has two tools: a live weather API and a calculator. The trace shows each call it asks for and what came back.

Claude Haiku 5.5 through the AI Gateway
Check your understanding3 questions
  1. In tool calling, who actually runs the tool?

  2. A tool call times out. What's the best way to handle it?

  3. When should a human approve a tool call before it runs?

2BuildOne tool that reads, one that acts

Watch Robert add two tools first, one short clip per step, then do each step yourself: one that reads (live exchange rates) and one that acts (saves a job), with a human approving the save.

Done when: the model looks something up and, once you approve, saves a record.

  1. 1 Give your agent the spec

    Done when main.py has a convert_currency tool and a save_job tool.

  2. 2 Watch it read

    Done when a GBP salary comes back in US dollars.

  3. 3 Approve the action

    Done when you approve the save, and the job is in jobs.json.

  4. 4 Push to deploy

    Done when both tools work on your public link.

3CapstoneFirst tool on real data

First tool wired to real data.

4HomeworkConnect a public API

Find a public API your users would want and connect it.

For teachers: the day 3 teaching kit.