Function calling
Function calling lets an LLM invoke external tools by emitting a structured request matching a function specification provided in the prompt. The model decides when to call a function, with what arguments; the host application executes the call and returns the result for the model to incorporate. Function calling is the foundation of agentic LLM applications.
Function calling shifted LLMs from 'generators of text' to 'orchestrators of tool use' starting with OpenAI's June 2023 release; Anthropic, Google, and others followed with similar APIs. The function spec is typically JSON Schema describing parameters and types; the model decides which function (if any) to call based on the user's request. Modern implementations support parallel function calling (multiple tools in one turn) and structured outputs that guarantee the response matches the schema. The pattern enables agents to read files, query databases, call APIs, run code — turning the LLM into a controllable executor of larger workflows.
Related terms
- Tool use (LLM agent)
Tool use is the LLM-agent pattern in which the model has access to a defined set of tools — read file, search web, run code, query API — and decides which to invoke and with what arguments based on the user's request and the current state.
- Agent loop
An agent loop is the orchestration pattern where an LLM iteratively reasons, calls tools, observes results, and continues — until a terminal condition is met (task complete, max iterations reached, error).
- Structured output
Structured output is the LLM feature that guarantees the response matches a provided schema (JSON Schema, Zod, Pydantic) — eliminating the parsing failures and format drift that plagued early LLM applications.