Function Calling
Function calling enables agents to invoke custom functions you define, extending their capabilities with business logic, external APIs, and system integrations.
How It Works
- Define functions with clear descriptions and parameters
- Agent determines need based on user request
- Run status changes to
requires_action
- Your code executes the actual function
- Submit results back to agent
- Agent processes and generates response
The agent requests function calls but doesn’t execute them. Your application code must handle execution.
Quick Start
Handling Function Calls
Best Practices
- Write clear function descriptions
- Define required parameters explicitly
- Return structured JSON
- Handle errors gracefully
- Implement timeout logic (runs expire after 10 minutes)
See Azure Functions for serverless hosting.