Skip to main content
Claude models with extended thinking, vision, and tool use. Supports Claude Sonnet, Opus, and Haiku.
from agno.agent import Agent
from agno.models.anthropic import Claude

agent = Agent(
    model=Claude(id="claude-sonnet-4-5-20250929"),
    markdown=True,
)

agent.print_response("Explain the halting problem", stream=True)

Tool Use

from agno.agent import Agent
from agno.models.anthropic import Claude
from agno.tools.yfinance import YFinanceTools

agent = Agent(
    model=Claude(id="claude-sonnet-4-5-20250929"),
    tools=[YFinanceTools(stock_price=True)],
    markdown=True,
)

agent.print_response("What's AAPL's stock price?", stream=True)

Vision

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

agent = Agent(
    model=Claude(id="claude-sonnet-4-5-20250929"),
    markdown=True,
)

agent.print_response(
    "Tell me about this image",
    images=[Image(url="https://upload.wikimedia.org/wikipedia/commons/0/0c/GoldenGateBridge-001.jpg")],
    stream=True,
)

Extended Thinking

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

agent = Agent(
    model=Claude(
        id="claude-sonnet-4-5-20250929",
        max_tokens=16000,
        thinking={"type": "enabled", "budget_tokens": 10000},
    ),
    markdown=True,
)

agent.print_response(
    "Solve step by step: A farmer has 17 sheep. All but 9 die. How many are left?",
    stream=True,
)

Structured Output

from pydantic import BaseModel, Field
from agno.agent import Agent
from agno.models.anthropic import Claude

class MovieScript(BaseModel):
    name: str = Field(..., description="Movie name")
    setting: str = Field(..., description="Movie setting")
    genre: str = Field(..., description="Movie genre")
    characters: list[str] = Field(..., description="Character names")
    storyline: str = Field(..., description="3 sentence storyline")

agent = Agent(
    model=Claude(id="claude-sonnet-4-5-20250929"),
    description="You write movie scripts.",
    output_schema=MovieScript,
)

agent.print_response("New York")

Run Examples

export ANTHROPIC_API_KEY=xxx

# Clone and run
git clone https://github.com/agno-agi/agno.git
cd agno/cookbook/92_models/anthropic

python basic.py
python tool_use.py
python thinking.py