Learn · Beginner
Tool Use and Function Calling: How LLMs Act on the World
Tool use, also called function calling, is how a language model stops being a clever autocomplete and starts affecting the world. Instead of answering a question from memory, the model can emit a structured request to call an external function -- search the web, run a database query, execute code, book a flight -- your application runs that function, and the result is fed back into the conversation so the model can keep reasoning. It is the single most important primitive behind every AI agent.
The problem it solves
A language model on its own is sealed inside its training data. It cannot know today's weather, look up your order history, do reliable arithmetic on large numbers, or take any action beyond producing text. Worse, when it does not know something it tends to hallucinate a plausible-sounding answer. Tool use breaks the seal. It lets the model delegate the things it is bad at -- fresh facts, exact computation, real actions -- to systems that are good at them, while the model does what it is uniquely good at: understanding the request and deciding what to do.
How it actually works
The mechanism is deceptively simple, and the key insight is that the model never runs anything itself. The flow has four steps:
1. You describe the tools. Along with the user's message, you give the model a list of available functions, each with a name, a description, and a schema for its arguments -- for example, get_weather(city: string). 2. The model chooses. Rather than replying in prose, the model outputs a structured object that says, in effect, "call get_weather with city = 'Paris'." This is just text the model generated, shaped to a schema. 3. Your code executes. Your application parses that request, actually calls the real weather API, and gets back a result like 18C, cloudy. 4. You feed the result back. You append the tool's output to the conversation and ask the model to continue. Now, with the real data in hand, it writes the final answer.
The analogy is a smart manager who cannot leave their office. They can read any report and make any decision, but to get information or take action they write a precise memo -- "pull Q3 sales for the west region" -- hand it to an assistant, and wait for the result before deciding the next step. The manager's power is judgment; the assistant's power is access. Function calling is exactly that division of labor, and it is why the model deciding to call a dangerous tool is safe as long as your code checks the request before running it.
From one call to an agent
A single tool call is useful, but the real power comes from looping. If, after reading the weather, the model decides it needs to also check flight prices, it can emit another tool call, read that result, and continue -- reasoning and acting in alternation. This interleaving of thought and action is the idea behind the influential ReAct pattern (Yao et al.), and repeating it until a goal is met is precisely what turns tool use into an AI agent. Toolformer (Schick et al. at Meta) showed models could even teach themselves when to call tools by inserting API calls into training text, and Gorilla showed models could be trained to call from massive libraries of real APIs correctly.
Why it is everywhere in 2026
Modern models are trained specifically to be good at this. The frontier is now about calling tools efficiently: OpenAI's GPT-5.6, launched this week, introduced "programmatic tool calling," where the model writes a small program that chains several tool calls together in a sandbox without pausing to re-consult the model between each step -- turning a chatty back-and-forth into a single efficient batch. Its multi-agent beta lets one model coordinate several sub-models, each with their own tools. Every serious AI product -- coding assistants, research agents, customer-service bots -- is built on this primitive.
The honest limits
Tool use is powerful but not magic. The model can call the wrong tool, pass malformed arguments, or misread a result -- so real systems validate every call and often retry. It also opens a security surface: if a tool reads untrusted content, an attacker can hide instructions in that content to hijack the model, a risk covered in our lesson on prompt injection. And because the model decides which tools to call, giving it access to powerful actions (deleting files, sending money) demands the same guardrails you would put around any automated system. Used carefully, though, function calling is the bridge between a model that can only talk and a system that can actually get things done.
Toolformer: Language Models Can Teach Themselves to Use Tools
ReAct: Synergizing Reasoning and Acting in Language Models
Gorilla: Large Language Model Connected with Massive APIs
Key questions
What is function calling in an LLM?
Does the model actually run the code itself?
How is tool use different from an AI agent?
Cite this
APA
Ground Truth. (2026, July 9). Tool Use and Function Calling: How LLMs Act on the World. Ground Truth. https://groundtruth.day/learn/tool-use-and-function-calling.html
BibTeX
@misc{groundtruth:tool-use-and-function-calling,
title = {Tool Use and Function Calling: How LLMs Act on the World},
author = {{Ground Truth}},
year = {2026},
month = {jul},
url = {https://groundtruth.day/learn/tool-use-and-function-calling.html}
}