Betas

Inspect beta names known to the installed Anthropic SDK and select a model with the required context window.

Beta features are experimental capability extensions for Anthropic models. You can use them with the betas parameter of the Agno Claude model class.

This source inspects a historical context-window beta. AnthropicBetaParam lists names known to the installed SDK, not every feature available to your account. Agno's default Claude model is Sonnet 4.5, whose documented context window is 200k tokens. For a current 1M-token model, use Claude(id="claude-sonnet-4-6") without the context beta header. See context windows. The sample has no weather tool, so it cannot retrieve current Tokyo weather.

betas.py
"""Example demonstrating how to use Anthropic beta features.

Beta features are experimental capability extensions for Anthropic models.
You can use them with the `betas` parameter of the Agno Claude model class.
"""

import anthropic
from agno.agent import Agent
from agno.models.anthropic import Claude

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
# Setup the beta features we want to use
betas = ["context-1m-2025-08-07"]
model = Claude(betas=betas)

# Note: you can see all beta features available in your Anthropic version like this:
all_betas = anthropic.types.AnthropicBetaParam
agent = Agent(model=model)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
# The beta features are now activated, the model will have access to use them.
if __name__ == "__main__":
    print("\n=== All available Anthropic beta features ===")
    beta_lines = "\n- ".join(str(b) for b in all_betas.__args__[1].__args__)
    print(f"- {beta_lines}")
    print("=============================================\n")

    agent.print_response("What is the weather in Tokyo?")

Run the Example

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Install dependencies

uv pip install -U agno anthropic

Export your Anthropic API key

export ANTHROPIC_API_KEY="your_anthropic_api_key_here"

Choose the current context-window configuration

Replace model = Claude(betas=betas) with model = Claude(id="claude-sonnet-4-6"). The SDK beta-name inspection can stay; replace the weather question with a task using information you provide.

Run the example

Save the code above as betas.py, then run:

python betas.py

Full source: cookbook/90_models/anthropic/betas.py