Skip to main contentSkip to navigation
Developers & APIs · F

Function calling

Function calling denotes a large language model's (LLM) ability to output structured calls to predefined functions or tools, including the fitting arguments as JSON. The model decides from the user's request which function should be called with which values; the application then actually carries the call out. Function calling is the technical basis for tool use and for autonomous AI agents.

Also known as: function calls, tool calling, LLM function calling

What is function calling?

Function calling extends a Language model the ability not just to produce text but to propose structured function calls. For this, functions with their name, description and expected parameters are made known to the model in advance. If the model recognises that a task requires calling one of these functions, it outputs a corresponding call with the fitting arguments.

Importantly: the model does not run the function itself. It merely supplies a structured description of the call it wants, generally as JSON. The surrounding application handles the actual execution and then returns the result to the model.

How does function calling work step by step?

The process typically follows several steps. First the model receives the user request and a description of the available functions. The model decides whether and which function is needed and outputs a structured call with arguments.

The application validates that call and runs the function, such as a database query, an APIcall or a calculation, and passes the result back to the model. With that result the LLM finally words a natural answer the user can understand. On complex tasks several such calls can follow one another.

Why does function calling matter?

Language models alone have only the knowledge from their training and cannot reach current or external data on their own. Function calling overcomes that limit by connecting models to real functions, data sources and systems.

Current information can thus be fetched, actions triggered and reliable, structured results achieved instead of relying on freely generated text. Function calling thereby makes AI applications far more capable, precise and practical and reduces the risk of hallucinations on data-driven tasks.

Function calling as the basis for tool use and AI agents

Function calling is the technical core of Tool use, that is a model’s ability to use external tools. Only through this can AI agents act independently: they plan tasks, choose suitable functions, carry out steps and react to the results.

In agentic systems, function calling enables multi-step processes in which a model calls functions repeatedly, evaluates intermediate results and adjusts its approach. It is thus the bridge between an LLM's language understanding and concrete execution in software.

Function calling in practice

In real applications, function calling connects LLMs to APIs, databases, search systems or internal tools, from booking an appointment to analysing business data. Clear function definitions, sound validation and well-considered error handling are decisive for reliable results.

When designing and building such AI solutions Elisabit, as a digital agency for Online marketing, SEO and AI solutions, so function calling, tool use and agents fit safely and profitably into your processes.

Frequently asked questions

Does the language model run the function itself?

No. The model only outputs a structured call with arguments, usually as JSON. The actual execution is handled by the surrounding application, which then returns the result to the model.

How do function calling and tool use differ?

Function calling is the technical mechanism by which an LLM outputs function calls. Tool use describes the overarching concept of using external tools and is built technically on function calling.

What role does JSON play in function calling?

JSON is the usual format in which the model outputs the function name and arguments in a structured way. This standardised format can be read and processed reliably by the application.

Why does function calling matter for AI agents?

AI agents have to carry out actions and use external systems to get tasks done. Function calling provides the structured basis for that, so agents can choose functions deliberately, have them run and react to the results.

Put AI to work for your business?

We help you integrate artificial intelligence into your processes, your marketing and your website — strategically and securely.

Request a project

Stefan

Your contact

Stefan

I look forward to hearing about your project and finding the best solution together.