Skip to main content

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

  1. Define functions with clear descriptions and parameters
  2. Agent determines need based on user request
  3. Run status changes to requires_action
  4. Your code executes the actual function
  5. Submit results back to agent
  6. 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.