BeginnerCoder

Lesson 17 — Multiple tools

Picking the right tool

Real agents have several tools and the model picks one per step. Here we have three:

  • calculator — exact maths (models often get arithmetic wrong).
  • clock — the date and time (a model does not know what day it is). We freeze the time in NOW so the output is always the same.
  • lookup — searches a small glossary (a dict of terms and meanings).

The model picks by name; your registry decides what actually exists. If the model asks for a tool that is not registered, the agent answers with an error instead of crashing.

Watch out: never run model text with eval() — that would let the model (or anyone who tricks it) run any code. The calculator below splits "12 * 7" into parts and only knows four operators.

Why it matters: more tools means more useful agents — and more need for clear names and a strict registry.

Want it another way?
Task

Finish lookup(term) so it returns the glossary entry (or "not found"), and register it in TOOLS.

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

← Back
Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.

Keep going with AI Agents Foundations

Ready for more? Optional paid resources that pick up where this lesson leaves off.

Some links on this page are affiliate links: we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases.