Agentic AI Chapter 5 / 16 · Tools

05 Tools

Give the genius
a phone.

On its own, an LLM is a genius locked in a room with no phone. It 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.

Function calling Information Computation Files Communication

The idea

A tool is just a function the agent can call.

Strip away the mystique and a tool is nothing exotic: it's 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.

Here's the part that feels like magic. Modern LLMs are specifically trained to look at a list of tools you hand them and decide which one to call, when to call it, and with what arguments — all on their own. You describe the tools; the model orchestrates them. That skill has a name: function calling, or tool use. It's the single ability that turns a chatbot into an agent.

Mental model

The model never runs the tool itself. It just says "please call get_weather("Tokyo")," your code runs it, and you hand the answer back. The LLM is the brain deciding what to do; your program is the hands that actually do it.

The superpower

Two things at once: parallel tool calls.

Ask a genius on the phone for two facts and they'd make two calls — but a good agent makes both calls at the same time. When a question needs several independent facts, the model can fire off multiple tool calls in a single breath and wait for them together. Doing it one-after-another would take twice as long for no reason. Watch it grab Tokyo and London simultaneously.

UserWhat's the weather in Tokyo and London right now?
↓  one turn, two tool calls fired together  ↓
get_weather("Tokyo")
calling…
🌧Tokyo · 18°Clight rain
get_weather("London")
calling…
☁️London · 12°Ccloudy
Answer Right now it's 18°C with light rain in Tokyo and 12°C and cloudy in London. Pack an umbrella for Tokyo. ☔
Both spinners appear together and resolve together. Fired one at a time, this same task would take roughly longer.

The toolbox

The five kinds of tools.

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.

🔎

Information

Reach out and fetch fresh facts the model never saw in training.

web searchencyclopedianewsweather
🧮

Computation

Offload exact math and logic instead of guessing at numbers.

run Pythoncalculatordatabase queries
📄

Files

Read what's on your disk and write results back out.

read PDFsparse spreadsheetswrite files
✉️

Communication

Actually do things in the world on your behalf.

send emailpost a messagebook calendar

Meta-tools

Tools that call other AI — the agent reaching for more brains.

call another modelgenerate imagestranslatetext-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 description is the interface.

Here's what trips up every beginner: the model picks a tool based entirely on the description you wrote for it — nothing else. It can't peek inside the function. A vague description and the model guesses wrong or ignores the tool completely. A precise one and it reaches for exactly the right tool, every single time. Writing tool descriptions is less coding and more writing clear instructions for a brilliant new intern.

✗ Vague

"get_data — gets some data"

The model has no idea what data or when to use it. It either skips the tool or calls it with garbage arguments and hopes.

✓ Precise

"get_stock_price(ticker) — returns the current USD price for a stock ticker like AAPL. Use for any live market-price question."

Now the model knows exactly what it does, what to pass in, and when to reach for it. Right tool, right arguments, first try.

In real code

A tool is a function plus a good docstring.

You write an ordinary function, describe it clearly, and hand its schema to the model. When the model decides it needs that tool, it doesn't run anything — it hands you back a tool call, and your loop executes it. Notice how the docstring becomes the description the model reads.

tools.py
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__,
          "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 itself; your agent loop (Chapter 4) 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.

Chapter 5 in one breath

Tools are the agent's hands.

An LLM alone is a genius with no phone. A tool is just 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 and it stops just talking and starts doing. Next: where does it keep everything it learns?

🖥 Present this chapter

A matching slide deck with speaker notes — press S for notes, F for fullscreen.

Open the slides →