AI & Automation

Function calling

A capability of modern language models that lets them invoke external functions — querying databases, calling APIs, or triggering actions — by generating structured JSON that your code executes. The mechanism that turns chatbots into agents.

How function calling works

You describe available functions to a language model — their names, parameters, and what they do. When the model determines it needs to use one, instead of generating text it generates a structured JSON object specifying which function to call and with what arguments. Your application executes the function and feeds the result back to the model.

Example: You tell the model it has a check_stock(product_id) function. A customer asks "Is the oak desk in stock?" The model generates {"function": "check_stock", "args": {"product_id": "oak-desk-01"}}. Your code runs the query, returns the result, and the model responds: "Yes, the oak desk is currently in stock with delivery in 3–5 working days."

Why it matters

Function calling is the bridge between conversational AI and real-world action. It's what enables AI agents to do things rather than just talk about things. Combined with the Model Context Protocol, it creates a standardised way for models to interact with any external system.

Parallel and sequential calls

Modern models can make multiple function calls in parallel ("check stock for these three products simultaneously") or chain them sequentially ("look up the customer, check their order history, then calculate their loyalty discount"). This makes complex multi-step workflows possible within a single conversation turn.

Say hello

Quick intro