Skip to main content

Module foundry

Module foundry 

Source
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:

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§

AnthropicFoundryClient
An Anthropic Messages API transport for Claude models hosted on Azure AI Foundry (POST {base_url}{path}).

Constants§

ANTHROPIC_FOUNDRY_VERSION
Default anthropic_version sent in the request body. This is not drawn from stable, publicly documented Azure AI Foundry API reference the way crate::bedrock::ANTHROPIC_BEDROCK_VERSION and crate::vertex::ANTHROPIC_VERTEX_VERSION are — see the module docs. Overridable via AnthropicFoundryClient::with_anthropic_version.
DEFAULT_PATH
Default path suffix appended to base_url. Overridable via AnthropicFoundryClient::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 via AnthropicFoundryClient::with_scope if a specific Foundry deployment requires a different audience.