function calling
Function calling is a model capability in which the model chooses a named function or tool and outputs structured arguments (typically in JSON format) according to a defined schema, so that the application can execute the call and return the results back to the model.
It enables grounded actions and real-time data access by bridging natural language to APIs, databases or utility tools, such as calculators or search.
Providers expose tool or function declarations and schemas. The model decides when and how to call a function, while your application executes the call and returns the output for a final response. Providers also ship built-in, server-side tools, such as web search or code execution, that they run on their own infrastructure and return the results for you.
Best practices include providing clear tool descriptions and parameter schemas, validating model-generated arguments, enforcing least-privilege execution, and auditing calls to mitigate security and misuse risks.
Related Resources
Course
Building Type-Safe LLM Agents With Pydantic AI
Build type-safe LLM agents in Python with Pydantic AI using structured outputs, function calling, and dependency injection.
By Leodanis Pozo Ramos • Updated Aug. 1, 2026