Models and training

Function calling

Function calling is a capability that lets a language model request that the application run a defined tool, such as a database lookup, an API call or a calculation, by returning the tool's name and structured arguments instead of plain text.

On its own, a language model can only produce text. Function calling, also called tool use, is how it reaches beyond that. The builder describes a set of tools to the model, such as "look up an order by number" or "book a meeting slot", and the model can respond by asking for one to be run with specific inputs. The application runs it and returns the result, and the model carries on. This is the mechanism underneath most AI agents and assistants that act on real systems.

How it works

Each tool is described with a name, a plain-language explanation of what it does and a schema for its inputs. A typical exchange runs:

  1. The user asks, "Where is order 4471?"
  2. The model, seeing an order-lookup tool, replies with a tool call: the tool name and the order number as an argument.
  3. The application validates the request, queries the order system and sends the result back to the model.
  4. The model writes the answer for the user, using the real order status.

Key points for buyers:

  • The model never runs anything itself. The application decides whether to execute a call, which is where permissions and safety checks belong.
  • Descriptions matter. The model chooses tools based on how they are described, so clear names and explanations reduce wrong calls.
  • Calls can chain. Agents may call several tools in sequence, using each result to decide the next step, as in an agentic workflow.

Provider APIs differ in detail but follow this pattern. The Model Context Protocol standardises how tools are offered to AI applications so the same tools can be reused across them.

What it means for cost

Function calling turns an AI build into an integration project. Each tool needs a working connection to an existing system, input checks, sensible error messages, permission rules and tests, which is ordinary API integration work plus testing of how the model chooses tools. The number of tools and how many of them change data are good predictors of build size.

Running costs rise too, because each tool round trip is another model request, and tool descriptions are sent with every call. Ask a builder which tools are read-only, which actions need user confirmation, and how wrong or failed calls are caught and logged.

Common questions

Can the model call any function it wants?

No. It can only request the tools the builder has described, and the application decides whether to run each request. Good builds check every call against the user's permissions before executing it.

What happens if the model calls the wrong tool?

The application should validate inputs and return a clear error, which lets the model correct itself. For actions with real consequences, such as payments or deletions, builds usually ask the user to confirm first.

Is function calling the same as an AI agent?

Function calling is a building block. An agent is a system that uses it repeatedly, deciding which tools to call and in what order to reach a goal.

Related terms

Pricing a build that involves Function calling? Send the brief and get a fixed price set next to the market range.Get a quote