Chapter 5 · Tools
Tools are how an LLM stops just talking and starts touching the real world — the hands bolted onto the loop.
The problem
On its own, an LLM can reason beautifully — but it only knows what it read during training. It can't look up today's price, read the file on your desk, send an email, or run a line of code.
Tools are how you slide a phone under the door — and suddenly the genius can touch the real world.
The idea
Strip away the mystique: a tool is a plain function — get_weather(), send_email(), run_python() — that reaches out and touches something the model can't reach on its own.
The genius does the thinking; the tool does the doing.
The magic
Modern LLMs are trained to look at a list of tools you hand them and decide it all on their own:
Which tool out of the toolbox fits this exact request.
The moment to reach for it — or not to reach at all.
The precise arguments to pass into it.
You describe the tools; the model orchestrates them. That skill — function calling — is what turns a chatbot into an agent.
Mental model
The LLM doesn't execute anything. It just says "please call get_weather("Tokyo")," your code runs it, and you hand the answer back.
The model is the brain deciding what to do; your program is the hands that actually do it.
The superpower
When a question needs several independent facts, a good agent fires the calls together in one turn and waits for them as a batch — instead of one-after-another for no reason.
The toolbox
Almost every tool an agent uses falls into one of five buckets. Learn the buckets and you'll instantly know what an agent could do the moment you see its toolbox.
Fetch fresh facts the model never saw in training — web search, news, weather.
Offload exact math and logic instead of guessing — run Python, query a database.
Read what's on your disk and write results back — PDFs, spreadsheets, output files.
The toolbox
Actually do things in the world on your behalf — send an email, post a message, book a calendar slot.
Tools that call other AI — the agent reaching for more brains. Call another model, generate an image, translate, text-to-speech.
Mix & match: real agents carry a handful from several buckets — search to learn, Python to crunch, email to deliver — chained together in one loop.
The craft
The model picks a tool based entirely on the description you wrote — nothing else. It can't peek inside the function. Writing tool descriptions is less coding and more writing clear instructions for a brilliant new intern.
Vague vs. precise
"get_data — gets some data"
The model has no idea what data or when to use it. It skips the tool or calls it with garbage arguments and hopes.
"get_stock_price(ticker) — returns the current USD price for a ticker like AAPL. Use for any live market-price question."
Now it knows exactly what it does, what to pass, and when to reach for it. Right tool, right arguments, first try.
In real code
def get_weather(city: str) -> str:
"""Get the current weather for a city.
Use this for any live weather question.
Args: city — the city name, e.g. "Tokyo"."""
return weather_api.lookup(city) # touches the outside world
# the schema the model actually reads to decide
schema = {"name": "get_weather",
"description": get_weather.__doc__, # the docstring IS the description
"args": {"city": "string"}}
reply = llm(messages, tools=[schema]) # THINK — model chooses
if reply.tool_call: # model asked for a tool…
out = get_weather(**reply.tool_call.args) # …your loop runs it
The model returns a tool_call — a name and arguments. It never executes anything; your agent loop does the running and feeds the result back.
The whole point
Tools are what turn a smart text-predictor into something that can actually do things — look things up, crunch numbers, read your files, and act in the world.
Give the genius a phone, and it stops just talking and starts doing.
Chapter 5 in one breath
An LLM alone is a genius with no phone. A tool is a function it can call to touch the world, and function calling lets the model choose which one, when, and with what arguments — even firing several in parallel. They come in five flavors, and the model picks them entirely from the descriptions you write.
Give the genius a phone — next, where does it keep everything it learns?
Next up
The agent can now think, act, and reach the world. But every turn it starts fresh — so where does it keep what it has already figured out? That's memory.
Press S for speaker notes · F for fullscreen · → to advance.