Claude to an Agent.
Installation
anthropic>=0.77.0, and the extra pins it. That release is the first with the output_config request parameter, which Agno now uses for structured output; Agno also routes temperature, top_p, and top_k through extra_body, which is how the Claude models keep working on anthropic 1.0.0, where output_format and those sampling parameters were removed from the SDK’s message methods. If you pin the SDK yourself, raise the floor: on an older SDK, a request that sets output_config fails at send time with TypeError: ... unexpected keyword argument 'output_config'; plain requests are unaffected.
Authentication
Set theANTHROPIC_API_KEY environment variable. Create a key in the Claude Console.
Example
agent.py
agent.py, then run:
Model Selection
Claude defaults to claude-sonnet-4-5-20250929 in Agno v2.7.2. Pass another model ID with Claude(id=...) when a different capability or latency profile fits the use case.
See Anthropic’s current model comparison and model lifecycle table before deploying a pinned model.
Claude 4.5 model IDs use dated snapshots. Shorter names such as
claude-sonnet-4-5 are aliases. Starting with Claude 4.6, dateless IDs such
as claude-sonnet-4-6 are canonical pinned versions, not rolling aliases.Supported Input
Agno sends image URLs to Anthropic as base64 data after downloading them. Anthropic’s request-size, image-size, page-count, and model limits still apply. See the vision limits and PDF limits.
Request Limits
The Messages API requiresmax_tokens. Agno sends 8192 unless max_tokens is set on Claude. Anthropic also accepts 0 for prompt-cache pre-warming, but Agno v2.7.2 omits that falsy value; use a positive value with this adapter. See the Messages API reference.
Anthropic also applies organization and workspace rate limits. See the rate-limit documentation.
Beta Features
Pass exact Anthropic beta names withbetas. Features that add request fields also need their matching Agno parameters. This context-editing configuration sends both the required beta and request body:
Prompt Caching
Setcache_system_prompt=True to add a prompt-cache breakpoint to the agent’s system prompt:
Structured Outputs
Pass a Pydantic model asoutput_schema to use Claude’s native structured outputs. Anthropic supports structured outputs on Claude Opus 4.1, the Claude 4.5 families, and later models. Claude 3.x, Claude Sonnet 4, and Claude Opus 4 do not support the feature.
Agno v3.0 sends structured output through Anthropic’s
output_config.format
request shape, which requires anthropic>=0.77.0 (the agno[anthropic]
extra pins it). Earlier Agno versions used the legacy output_format
request, which anthropic 1.0.0 removed.Params
Claude is a subclass of the Model class and supports the inherited model parameters.