Skip to main content
Use various open source models hosted on Azure’s infrastructure. Learn more here. Azure AI Foundry provides access to models like Phi, Llama, Mistral, Cohere and more.

Authentication

Navigate to Azure AI Foundry on the Azure Portal and create a service. Then set your environment variables:
export AZURE_API_KEY=***
export AZURE_ENDPOINT=***  # Of the form https://<your-host-name>.<your-azure-region>.models.ai.azure.com/models
# Optional:
# export AZURE_API_VERSION=***

Example

Use AzureAIFoundry with your Agent:
from agno.agent import Agent
from agno.models.azure import AzureAIFoundry

agent = Agent(
    model=AzureAIFoundry(id="Phi-4"),
    markdown=True
)

# Print the response on the terminal
agent.print_response("Share a 2 sentence horror story.")

Advanced Examples

View more examples here.

Parameters

ParameterTypeDefaultDescription
idstr"gpt-4o"The id of the model to use
namestr"AzureAIFoundry"The name of the model
providerstr"Azure"The provider of the model
temperatureOptional[float]NoneControls randomness in the model’s output (0.0 to 2.0)
max_tokensOptional[int]NoneMaximum number of tokens to generate in the response
frequency_penaltyOptional[float]NonePenalizes new tokens based on their frequency in the text so far (-2.0 to 2.0)
presence_penaltyOptional[float]NonePenalizes new tokens based on whether they appear in the text so far (-2.0 to 2.0)
top_pOptional[float]NoneControls diversity via nucleus sampling (0.0 to 1.0)
stopOptional[Union[str, List[str]]]NoneUp to 4 sequences where the API will stop generating further tokens
seedOptional[int]NoneRandom seed for deterministic sampling
model_extrasOptional[Dict[str, Any]]NoneAdditional model-specific parameters
request_paramsOptional[Dict[str, Any]]NoneAdditional parameters to include in the request
api_keyOptional[str]NoneThe API key for Azure AI Foundry (defaults to AZURE_API_KEY env var)
api_versionOptional[str]NoneThe API version to use (defaults to AZURE_API_VERSION env var)
azure_endpointOptional[str]NoneThe Azure endpoint URL (defaults to AZURE_ENDPOINT env var)
timeoutOptional[float]NoneRequest timeout in seconds
max_retriesOptional[int]NoneMaximum number of retries for failed requests
http_clientOptional[httpx.Client]NoneHTTP client instance for making requests
client_paramsOptional[Dict[str, Any]]NoneAdditional parameters for client configuration
AzureAIFoundry is a subclass of the Model class and has access to the same params.

Supported Models

Azure AI Foundry provides access to a wide variety of models including:
  • Microsoft Models: Phi-4, Phi-3.5-mini-instruct, Phi-3.5-vision-instruct
  • Meta Models: Meta-Llama-3.1-405B-Instruct, Meta-Llama-3.1-70B-Instruct, Meta-Llama-3.1-8B-Instruct
  • Mistral Models: Mistral-large, Mistral-small, Mistral-Nemo
  • Cohere Models: Cohere-command-r-plus, Cohere-command-r
For the complete list of available models, visit the Azure AI Foundry documentation.
I