Tool Calling

15 min read

An LLM only knows what it learned in training and what is in your prompt. It cannot check your train ticket or send an email. With tool calling, the model asks your code to do these jobs. Then it uses the result to answer.

New words

Tool calling
The model asks your code to run a function, then uses the result.
Schema
A form that lists the inputs a tool takes and the type of each.
Agent loop
The cycle of asking the model, running its tool and sending back the result.
Round trip
One request to the model and its reply.
Latency
The time you wait before the answer arrives.
Side effect
An action that changes something real, such as a refund or an email.
Least privilege
Give a tool only the smallest access it needs.

What you will learn

  1. Why does the model need tools?
  2. How does tool calling work?
  3. Try it: follow the agent loop step by step
  4. How do you write good tools?
  5. What can go wrong?
  6. Habits for a real system
  7. In code
  8. In a real system
  9. Interview tip
  10. Key takeaways

10 quiz questions at the end.

Start this lesson

The full lesson, with interactive demos and the quiz, opens after you sign in with Google. It is free.

All lessons · Back to the roadmap