Expand description
AnthropicFoundryClient: Anthropic (Claude) models hosted on
Azure AI Foundry,
spoken over a Foundry Anthropic deployment’s Messages-shaped endpoint
(POST {base_url}{path}, defaulting to {base_url}/v1/messages).
Like crate::bedrock::AnthropicBedrockClient and
crate::vertex::AnthropicVertexClient, this is a transport, not a new
wire format: the request body is the same Anthropic Messages API shape
AnthropicClient speaks directly, built via
crate::convert::build_cloud_request. Authentication is Microsoft Entra
ID (Authorization: Bearer <token>), via the
agent_framework_azure::TokenCredential abstraction that crate’s own
Azure OpenAI clients use — any of its real credential chains
(ManagedIdentityCredential, ClientSecretCredential,
AzureCliCredential, ChainedTokenCredential, …) work here unmodified.
§What’s not stably documented
Unlike Bedrock’s InvokeModel/anthropic_version pairing or Vertex AI’s
rawPredict/anthropic_version pairing, Azure AI Foundry’s Anthropic
integration does not (as of this writing) have a single, stable, publicly
documented route path or anthropic_version tag the way the other two
clouds do — Foundry deployments vary in how they expose partner models.
Both are therefore overridable defaults, not hardcoded assumptions:
- the path suffix defaults to
DEFAULT_PATH(/v1/messages) and can be changed per deployment viawith_path; - the
anthropic_versionbody field defaults toANTHROPIC_FOUNDRY_VERSIONand can be changed viawith_anthropic_version.
Callers should confirm both against their specific Foundry deployment’s documentation before relying on the defaults in production.
use std::sync::Arc;
use agent_framework_azure::StaticTokenCredential;
use agent_framework_anthropic::foundry::AnthropicFoundryClient;
use agent_framework_core::prelude::*;
let credential = Arc::new(StaticTokenCredential::new("eyJ0eXAi..."));
let client = AnthropicFoundryClient::with_token_credential(
"https://my-foundry-resource.services.ai.azure.com",
"claude-sonnet-4-5",
credential,
);
let agent = Agent::builder(client)
.instructions("You are concise.")
.build();
let reply = agent.run_once("Say hi").await?;
println!("{}", reply.text());Structs§
- Anthropic
Foundry Client - An Anthropic Messages API transport for Claude models hosted on Azure AI
Foundry (
POST {base_url}{path}).
Constants§
- ANTHROPIC_
FOUNDRY_ VERSION - Default
anthropic_versionsent in the request body. This is not drawn from stable, publicly documented Azure AI Foundry API reference the waycrate::bedrock::ANTHROPIC_BEDROCK_VERSIONandcrate::vertex::ANTHROPIC_VERTEX_VERSIONare — see the module docs. Overridable viaAnthropicFoundryClient::with_anthropic_version. - DEFAULT_
PATH - Default path suffix appended to
base_url. Overridable viaAnthropicFoundryClient::with_path— see the module docs for why this isn’t assumed to be stable across Foundry deployments. - DEFAULT_
SCOPE - Default Entra ID scope requested for the bearer token, matching the scope
agent_framework_azure::AzureOpenAIClient’s own documentation uses for Azure AI resources. Overridable viaAnthropicFoundryClient::with_scopeif a specific Foundry deployment requires a different audience.