Function Calling
Last updated June 11, 2026
What is Function Calling in simple terms?
In simple terms, function calling is how an AI asks a computer program to do something, in a tidy format the program can follow exactly — a precise fill-in-the-blanks request that software can actually carry out.
What is Function Calling?
Function calling is the structured mechanism by which a language model requests a specific external tool or function — naming it and supplying the inputs in a machine-readable format — so that surrounding software can run it and return the result for the model to use.
Language models speak in free-flowing prose, but software needs precise, predictable instructions — it can't act on "oh, maybe look up the weather somewhere sunny." Function calling is the agreed format that lets the two work together. A developer describes the functions the model is allowed to trigger — for example, a `get_weather` function that needs a city name and a date — and when a user's request calls for it, the model responds not with a sentence but with a neat, structured object: the name of the function and the exact inputs to give it, usually written as JSON (a simple, widely used data format computers read easily). The application then runs that real function and hands the result back to the model.
It helps to see where function calling sits relative to the broader idea of tool use. Tool use is the overall capability — an AI getting things done through external software. Function calling is the specific handshake that makes it reliable: it forces the model's intention into a rigid shape that a program can execute without ambiguity. This matters because the alternative — having the model write loose text and hoping software can parse it correctly — is fragile and error-prone. By contrast, a well-formed function call is unambiguous: the function is named, the inputs are typed, and either it runs or it clearly doesn't. That reliability is exactly what AI agents depend on when they chain many actions together.
For the people building AI products, function calling is one of the most important everyday tools, because it's the clean bridge between an AI's language ability and the rest of a software system — databases, payment systems, internal APIs, you name it. It does come with responsibilities: the model can request a function with wrong or even nonsensical inputs, so the surrounding code still has to validate everything before acting, and sensitive functions need permission checks. There's a subtler risk too: the data a function sends back can itself contain hidden instructions planted by a third party, trying to hijack the model into doing something it shouldn't — so even a tool's output can't be blindly trusted. The model proposes; well-built software decides whether to actually carry it out.
Real-world example of Function Calling
Picture a food-delivery app with an AI helper, and you type "reorder my usual from last Friday." Behind the scenes the model doesn't try to guess your order in prose — it produces a structured function call like find_order with the inputs customer, day: "last Friday". The app runs that function against its real order history, finds the order, and passes it back. The model might then issue a second call, place_order, with that order's ID. Each step is a precise, fill-in-the-blanks request the software can execute exactly, which is why the right meal actually turns up — rather than the model writing a friendly paragraph about a burger that never gets ordered.
Related terms
Frequently asked questions about Function Calling
What is the difference between function calling and tool use?
Tool use is the general ability of an AI to operate external software to accomplish a task; function calling is the specific, structured way the model requests one of those tools. When a model does function calling, it outputs a machine-readable message naming the function and its inputs, which the surrounding software then runs. So function calling is the precise mechanism, and tool use is the broader capability it enables — every function call is an instance of tool use, expressed in a strict format.
How does function calling work?
A developer gives the model a list of available functions, each with a name, a description, and the inputs it expects. When a request needs one, the model replies with a structured object — typically JSON — specifying which function to call and what inputs to pass. The application validates and runs that real function, then returns the result to the model, which uses it to continue. The model never runs the function itself; it only produces the well-formed request, and trusted code decides whether to execute it.
What is function calling used for?
It's the standard way developers connect an AI model to the rest of a software system: fetching data from a database, looking up an account, checking inventory, sending a message, or triggering any in-house function. It underpins AI agents, which complete multi-step jobs by issuing a sequence of function calls. Anywhere you want a model's language understanding to drive real software actions reliably — rather than just describe them — function calling is the mechanism that makes the connection dependable.