Expand description
§agent-framework-anthropic
Anthropic (Claude) ChatClients for agent-framework-rs.
AnthropicClient talks directly to the Anthropic Messages API
(POST /v1/messages), the same way agent-framework-openai talks to Chat
Completions: hand-rolled request/response JSON conversion plus a
hand-rolled SSE parser, with no dependency on Anthropic’s own SDK.
use agent_framework_anthropic::AnthropicClient;
use agent_framework_core::prelude::*;
let client = AnthropicClient::new("sk-ant-...", "claude-sonnet-4-5-20250929");
let agent = Agent::builder(client)
.instructions("You are concise.")
.build();
let reply = agent.run_once("Say hi").await?;
println!("{}", reply.text());§Multi-cloud transports
Claude models are also available through three managed-cloud offerings,
each of which speaks the same Anthropic Messages API wire format
AnthropicClient does — only the URL shape, model-selection mechanism,
and authentication scheme differ. Each is a thin transport built on
convert::build_cloud_request (the direct API’s convert::build_request
minus the top-level model field, plus a cloud-specific
anthropic_version tag) rather than a reimplementation of the wire
format:
bedrock::AnthropicBedrockClient— AWS Bedrock’sInvokeModelAPI, SigV4-signed viaagent_framework_bedrock::sigv4(reused, not reimplemented).vertex::AnthropicVertexClient— Google Vertex AI’srawPredict/streamRawPredictpublisher-model routes, authenticated via a caller-suppliedvertex::VertexTokenProvider(no Google Cloud SDK dependency in this workspace; see that module’s docs).foundry::AnthropicFoundryClient— Azure AI Foundry Anthropic deployments, authenticated viaagent_framework_azure::TokenCredential(Microsoft Entra ID); see that module’s docs for the caveats around its non-stably-documented route/version defaults.
Re-exports§
pub use bedrock::AnthropicBedrockClient;pub use foundry::AnthropicFoundryClient;pub use vertex::AnthropicVertexClient;pub use vertex::StaticVertexToken;pub use vertex::VertexTokenProvider;
Modules§
- bedrock
AnthropicBedrockClient: Anthropic (Claude) models hosted on AWS Bedrock, spoken over Bedrock’sInvokeModelAPI rather than Bedrock’s own model-agnostic Converse API (POST https://bedrock-runtime.{region}.amazonaws.com/model/{model}/invoke).- convert
- Conversion between framework types and the Anthropic Messages API wire format.
- foundry
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).- vertex
AnthropicVertexClient: Anthropic (Claude) models hosted on Google Vertex AI, spoken over Vertex’srawPredict/streamRawPredictpublisher-model routes (POST https://{region}-aiplatform.googleapis.com/v1/projects/{project}/locations/{region}/publishers/anthropic/models/{model}:rawPredict).
Structs§
- Anthropic
Client - An Anthropic (Claude) Messages API chat client.