Tool Calling (Function Calling) Explained

Tool calling is how an LLM goes from talking to doing. It never runs code itself — it asks your program to run a named function, reads the result, and continues. That single mechanism is the engine inside every AI agent.

BytExplorer 6 min read July 17, 2026

A language model on its own can only produce text. It can't check today's weather, query your database, or restart a service — it has no hands. Tool calling (also called function calling) is the standard way to give it some, and understanding it demystifies every "AI agent" you'll ever meet. The key surprise: the model still doesn't run anything. It just asks.

The problem: a model can describe an action but not perform one

Ask a plain model to "restart the web service" and it will happily explain how — but it can't actually do it, and it doesn't know the current state of your systems. You need a bridge between the model's decision ("this should be restarted") and real code that performs it. Tool calling is that bridge.

What tool calling actually is

You give the model a list of tools — really just functions, each with a name, a description, and a schema of arguments:

{
  "name": "get_weather",
  "description": "Get the current weather for a city",
  "parameters": { "city": "string" }
}

Now when you ask a question, the model can reply in one of two ways: a normal text answer, or a structured request like "call get_weather with city=\"Berlin\"." Your code sees that request, runs the real function, and feeds the result back to the model, which then writes the final answer.

you ──▶ model: "call get_weather(city=Berlin)" ──▶ YOUR code runs it ──▶ "18°C, clear" ──▶ model answers

The model chooses what to call and with which arguments; your program does the actual calling. It never touches your systems directly.

The model is a decision-maker, not an executor. Function calling turns fuzzy intent ("check the weather") into a structured, machine-runnable request your code can trust — and keeps the model safely on the "deciding" side of the line.

Why the description and schema matter

The model picks a tool based purely on its name and description, and fills arguments to match the schema. Vague descriptions lead to the wrong tool or bad arguments. Good tool design — clear names, precise descriptions, tight schemas — is most of what makes an agent reliable. The schema also means the model's output is structured and validatable, not free text you have to parse and hope.

Why it matters

Function calling is the foundation of AI agents: an agent is just this call-run-return exchange placed in a loop, so the model can take several actions in sequence to finish a task. It's also how you get reliable structured output from a model, and how AI plugs into real systems — search, APIs, databases, internal tools. Every agent framework, however elaborate, is built on this one mechanism.

The mental model to keep

Think of the model as a dispatcher at a desk: it can't leave the desk, but it can fill out a form saying "run this function with these inputs" and hand it to the workers (your code) who do the job and report back. Your job is to define good forms (tools), run them safely, and return clean results. Master that exchange and you understand agents from the inside out.

Frequently Asked Questions

Is tool calling the same as function calling?

Yes — they're two names for the same mechanism: the model outputs a structured request to run a named function with arguments, and your code runs it.

Does the model execute the function itself?

No. It only produces the request; your program runs the function and feeds the result back to the model.

How is tool calling related to AI agents?

An agent is tool calling placed in a loop, so the model can take several actions in sequence to finish a task.

Put it into practice

Stop reading, start building

This pairs with a hands-on BytExplorer course — do it on your own machine and actually keep the skill.

More in Core Concepts