Back in the basics you learned what a model really does: it predicts text. It can't run code, open a file, or look anything up. Ask it "what's the weather in Tokyo right now" and it has no live data, so it either guesses or tells you it can't know. That's a hard wall for anything that needs a real answer.
Tool calling is how you get past that wall.
You tell the model about functions your program can run. A function to fetch the weather. A function that queries your database. A calculator. Each one has a name, a plain description of what it does, and the inputs it expects.
The model still can't run any of them. What it can do is ask you to. When
a question needs live data or real computation, instead of answering with text
the model replies "please call get_weather with city set to Tokyo". Your
code runs the real function, gets the real result, and hands it back. Then the
model writes the final answer using that result.
So the split is simple:
The model never touches your code, your database, or the internet. It only ever produces text. Tool calling just means some of that text is a structured request for you to run something, rather than a finished answer.
This one mechanism is what turns a text predictor into something useful in the real world. With tools defined, an assistant can:
Every "AI agent" you've heard about is built on this loop. Next you'll see the exact request and response that make it work.
Your lab setup
This VM comes preconfigured with your AI keys - just type claude to get started. Your key and URL are already set as $OPENAI_BASE_URL and $OPENAI_API_KEY.