What is Function Calling?
Also called function calls.
Function calling is a capability in which a language model, given descriptions of available functions, responds with a structured request naming one of them and supplying arguments, rather than replying in prose. The application receives that request, executes the function itself, and returns the result to the model. The model never runs any code.
The developer sends the model a list of function definitions, each with a name, a description, and a schema for its parameters. If the request calls for one, the model returns a call object instead of text. The application validates the arguments, performs the work, and appends the result to the conversation so the model can continue reasoning with real data.
This turns a text predictor into something that can act on live systems and produce reliable machine readable output. It arrived in mainstream model APIs in 2023 and quickly became the foundation of agent frameworks. Nearly everything described as an AI agent today is a loop built on repeated function calls, with the surrounding code deciding what actually runs.
The most persistent misunderstanding is that the model executes the function. It does not. It only proposes a call, and the application decides whether to run it, which is exactly where validation, permission checks, and human approval belong. A second mistake is assuming arguments are always sensible, since a model can invent values, confuse units, or choose a plausible but wrong function.
Function calling and tool calling generally describe the same mechanism under different vendor vocabulary. The related idea of structured output uses the same schema machinery to constrain a final answer rather than to request an action. Quality depends heavily on the descriptions supplied, so a poorly worded function description behaves like a functional bug.
Key points
- The model returns a structured call object instead of prose.
- The application executes the function; the model never does.
- Definitions carry a name, a description, and a parameter schema.
- Entered mainstream model APIs in 2023 and underpins most agents.
- Arguments can be wrong, so validate before executing anything.
In practice
An application defines one function, get_weather, taking a city and a unit. A user asks about the weather in Lisbon. Instead of guessing, the model returns a call naming get_weather with city set to Lisbon and unit set to celsius. The application queries a real weather service, gets back eighteen degrees, hands that number to the model, and the model writes the sentence the user reads.