Function Calling
The API mechanism that lets models invoke external tools by emitting structured JSON that matches a schema.
The API mechanism that lets models invoke external tools by emitting structured JSON that matches a schema.
Basic
Function calling is how AI agents actually USE tools. You define function schemas (name, description, parameters) in the API request. The model decides when to call them and emits JSON matching your schema. Your code executes the call and feeds back the result. OpenAI standardized function calling in 2023; now every frontier provider supports it.
Deep
Flow: (1) send request with function schemas, (2) model generates JSON tool call if it decides to use a tool, (3) your code validates + executes, (4) send result back as a tool message, (5) model continues or finishes. Parallel function calling (emit multiple tool calls per turn) reduces agent round-trips. OpenAI, Anthropic, Google, Mistral all support parallel calls. Quality of tool descriptions matters enormously · poorly described tools get skipped.
Expert
JSON Schema draft-07 is the canonical format. Models trained on function calling show 95%+ schema compliance in 2026. Errors still happen at edge cases · required field missing, wrong enum value. Production systems validate before execution. Structured Outputs (OpenAI) guarantees schema validity by constraining decoding. MCP extends function calling with a standardized protocol for tool discovery and execution across clients.
Depending on why you're here
- ·JSON Schema draft-07 standard
- ·Parallel calls reduce round-trips 2-5×
- ·Structured Outputs guarantees schema compliance via constrained decoding
- ·Clear tool descriptions > clever prompting · biggest lever
- ·Support parallel calls for agent latency wins
- ·Validate every tool call before executing · safety critical
- ·Function calling + MCP = the agent interop layer
- ·Quality converging across providers · less differentiation here
- ·Orchestration frameworks (LangGraph, Agent SDK) are the new battleground
- ·How AI talks to outside tools like search or calculators
- ·The building block of AI agents
- ·Standardized across most AI providers
Often confused with
Function calling is solved infrastructure. The interesting problems moved up the stack · to orchestration, memory, planning.