Ablaufskizze in vier Schritten: Nutzerfrage geht an das Sprachmodell, das Modell gibt einen strukturierten Funktionsaufruf mit Name und Werten aus, die umgebende Software führt den Aufruf beim externen Dienst aus, das Ergebnis fließt zurück ins Modell, das daraus die Antwort für den Nutzer formuliert.

Function Calling

Function calling means that a language model doesn't just write text, but recognizes when an external program is needed and formulates its call cleanly. The model supplies the name and values for the request, while it is executed outside the model.

A language model is a program that has learned from texts which words meaningfully follow one another. It can therefore formulate very well, but it cannot look anything up and cannot actually do anything. If you ask about the current weather in Hamburg, it simply doesn’t have that number. Function calling solves exactly this problem. The operator tells the model beforehand which external programs are available and what these programs need. Instead of inventing an answer, the model then outputs a structured request, such as: weather service, location Hamburg, date today.

From text generator to acting assistant

Without this technique, a chatbot remains a conversation partner without access to the world. It only knows what ended up in it during training, and this knowledge always has an end date. Stock prices, timetables, a shop’s inventory, or one’s own calendar are invisible to it. Function calling is the bridge to this data.

The second benefit is reliability. Language models are poor at calculating and tend to invent plausible but incorrect information. This is called hallucination. If the model instead passes the calculation on to a calculator and the question about the account balance to the bank software, the result is correct. The model then only has to decide whom to ask and formulate the answer comprehensibly.

Third, function calling is the technical foundation for so-called agents. This is the term for AI systems that plan and carry out several steps on their own, one after another. Without the ability to call tools, an agent would be incapable of acting. That is why the term has appeared in almost every product announcement by major AI providers since 2023.

Description, proposal, execution

At the beginning there is a list of available functions. For each function, the developer stores a name, a short description in plain language, and the required information. For a weather query, that would be, for example, location and date. This list is passed to the model together with the user’s question.

The model now checks whether one of the descriptions matches the question. If so, it does not respond with a sentence but with a machine-readable data block. This contains the function name and the matching values it has extracted from the question. Importantly: the model does not execute anything at all. It merely makes a very precise proposal.

The surrounding software takes over the execution. It calls the weather service, receives a number back, and sends this number back into the conversation. Only after that does the model formulate the actual answer for the user. You can imagine this like a waiter: he takes the order and passes it on correctly to the kitchen, but the cooking happens elsewhere. This intermediate step is also a safety measure, since the operator can review or reject every call.

Weather query, travel booking, company software

In everyday life, you usually only notice function calling by its result. When a chatbot states a current figure, searches a website, or adds an appointment to the calendar, there is usually a function call behind it. Voice assistants on phones also work according to this pattern when they set a timer or send a message.

In companies, this is the usual way to connect a language model to existing systems. A support chat can thus fetch the order status from the database, or an analytics software can start an evaluation. Related to this is the MCP standard, short for Model Context Protocol. It uniformly defines how such tools are registered, so that not every provider has to build its own solution.

A common misconception is that the model gains new abilities through function calling. That is not true. It only learns to make good requests. If a function’s description is unclear, it chooses the wrong one or supplies incorrect values. Carefully worded function descriptions are therefore a genuine part of the development work.

Subscribe free. Unsubscribe the second it sucks.

High-signal news across AI, business, UX, and tech. Every morning.