Azure AI Foundry Claude

Use Claude models through Azure AI Foundry with Agno agents.

Use Claude models through Azure AI Foundry. This uses Anthropic's native Messages API instead of the chat completions endpoint that Azure AI Foundry uses for other models.

Installation

uv pip install -U anthropic agno

First deploy a Claude model in Azure AI Foundry. Set id to the deployment name; the examples assume a deployment named claude-sonnet-4-6.

Authentication

Set your ANTHROPIC_FOUNDRY_API_KEY and ANTHROPIC_FOUNDRY_RESOURCE environment variables.

export ANTHROPIC_FOUNDRY_API_KEY=***
export ANTHROPIC_FOUNDRY_RESOURCE=***

Choose either a resource name or a full base_url, such as https://your-resource.services.ai.azure.com/anthropic/. They are mutually exclusive: clear ANTHROPIC_FOUNDRY_RESOURCE before using an explicit base URL or ANTHROPIC_FOUNDRY_BASE_URL.

Authenticate with an Azure AD token provider instead of an API key by passing azure_ad_token_provider to the Claude constructor.

Example

Use Claude with your Agent:

from agno.agent import Agent
from agno.models.azure.claude import Claude

agent = Agent(
    model=Claude(id="claude-sonnet-4-6"),
)

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

You can also use the string syntax:

agent = Agent(model="azure-foundry-claude:claude-sonnet-4-6")
View more examples here.

Parameters

ParameterTypeDefaultDescription
idstr"claude-sonnet-4-5"The specific Azure Foundry Claude model ID to use
namestr"AzureFoundryClaude"The name identifier for the model
providerstr"AzureFoundry"The provider of the model
resourceOptional[str]NoneThe Azure resource name (or set ANTHROPIC_FOUNDRY_RESOURCE)
base_urlOptional[str]NoneThe base URL, used instead of resource (or set ANTHROPIC_FOUNDRY_BASE_URL)
azure_ad_token_providerOptional[Callable]NoneAzure AD token provider for authentication
max_retriesOptional[int]NoneMaximum number of retries for failed requests

Claude (Azure AI Foundry) extends Anthropic Claude and runs its thinking-aware initialization, including trailing-user-message handling. It builds Azure requests separately and disables native structured-output and JSON-schema capability flags. Inheriting a parameter does not mean every Anthropic-native feature is enabled on this adapter.