What is Function Calling?
Function calling is a capability in modern large language models that allows them to recognize when external functions or tools should be invoked and generate structured requests for those invocations. Rather than trying to solve all tasks through text generation alone, models with function calling can identify situations where they need external capabilities (like searching a database, performing calculations, or accessing APIs) and output properly formatted function calls with appropriate parameters.
The mechanism typically works through a special training process where models learn to recognize task requirements that match available functions, then output structured JSON objects specifying which function to call and what arguments to provide. The model is given descriptions of available functions (their names, purposes, and parameter schemas) in the prompt. When the model determines a function call is needed, it generates a structured response rather than natural language text. The application executes the function and provides results back to the model, which can then continue its reasoning or provide a final answer.
Function calling has become foundational to agent architectures, enabling LLMs to orchestrate complex workflows involving multiple tools and external systems. It provides a more reliable and structured alternative to parsing tool use from natural language outputs. Most major LLM providers (OpenAI, Anthropic, Google, etc.) now support function calling natively, and it's extensively used in frameworks like LangChain, LlamaIndex, and agent platforms for implementing tool-using agents.