Runs expire 10 minutes after creation. Submit your tool outputs before they expire.
Usage support
The following table shows SDK and setup support.Prerequisites
Before you start, make sure you have:- A basic or standard agent environment.
- A Foundry project and a deployed model.
-
The SDK package for your language:
- Python:
azure-ai-projects(latest) - .NET:
Azure.AI.Extensions.OpenAI - TypeScript:
@azure/ai-projects(latest) - Java:
azure-ai-agents
- Python:
Create an agent with function tools
Function calling follows this pattern:- Define function tools — Describe each function’s name, parameters, and purpose.
- Create an agent — Register the agent with your function definitions.
- Send a prompt — The agent analyzes the prompt and requests function calls if needed.
- Execute and return — Your app runs the function and submits the output back to the agent.
- Get the final response — The agent uses your function output to complete its response.
Verify function calling works
Use these checks to confirm function calling is working:- Your first response contains an output item with
typeset tofunction_call. - Your app executes the requested function by using the returned arguments.
- Your app submits a follow-up response that includes a
function_call_outputitem and references the previous response, and the agent returns a natural-language answer.
Security and data considerations
- Treat tool arguments and tool outputs as untrusted input. Validate and sanitize values before using them.
- Don’t pass secrets (API keys, tokens, connection strings) in tool output. Return only the data the model needs.
- Apply least privilege to the identity used by
DefaultAzureCredential. - Avoid side effects unless you explicitly intend them. For example, restrict function tools to safe operations, or require explicit user confirmation for actions that change data.
- For long-running operations, return a status immediately and implement polling. The 10-minute run expiration applies to total elapsed time, not individual function execution.