Glossary
What is function calling?
In short
Function calling is a way for a language model to ask a program to do an action: the model picks a function and fills in its parameters, and your application code runs the request and returns the result.
AI agents · function calling
MMOOZZGG.com editorsChecked: 2 min read
For a child
Imagine you are playing shop, but you cannot count change yet. So you write a note to your older brother: “What is one hundred minus thirty?” He counts and gives you the answer, and you go on playing. A neural network can also write such notes to other programs: to ask them to count, find or save something. It presses nothing by itself; it only asks.
In plain words
A neural network on its own only writes text. It does not know the stock in your warehouse and cannot create a deal in your CRM. To make this possible, a developer gives the model a list of actions in advance: the name, the purpose and the data each needs. When a question needs an action, the model does not make up an answer. It returns a neat request: which action to call and with which parameters. The program runs the request and returns the result, and the model uses it to answer the person. This is how the question “where is my order?” works: the model asks for the status by order number and retells it.
For business
Through function calling, AI gets access to working systems: the CRM, the accounting program, the calendar, the product catalog. This is what turns a chat into a worker that checks stock, books time and creates requests. The cost depends on the number and complexity of integrations and on the size of the function descriptions: they go to the model with every request and are paid for as input tokens. The main risks: the model picks the wrong function or fills in a wrong parameter. So you limit dangerous actions, check parameters in code and send payments and deletions to a person for approval. A pilot with real requests is a good way to test a set of functions for your process.
For a specialist
Function calling, also called tool use, is a mode in which the model returns a structured call instead of text: the tool name and the arguments, following a JSON Schema. The application passes a list of tools with a name, a description and an input schema in the request. In the Anthropic API, such a response ends with the stop reason tool_use; the application runs the function and sends the result in a tool_result block, after which the model continues. There are client tools, which your code runs, and server tools, which the provider runs, such as web search. Parallel calls are possible, and tool_choice can force the choice of a tool. The Toolformer paper (Schick et al., 2023) showed that a model can call APIs on its own: it decided by itself when to call a calculator, a search engine or a translator. For reliability, teams use strict schema checks and handle call errors.
Example
A customer writes to a store’s chat: “Do you have these sneakers in my size?” The model calls the stock check function with the product code and size, gets the warehouse’s answer and says which stores have the pair today.
Related terms
Questions and answers
Can the model run a function by itself?
Sources
Where companies use it
Not sure whether your company needs this?
AI solutions map