Anthropic
Use Claude Sonnet 4, Claude Sonnet 4.5, and other Anthropic models with cagent.
Setup
# Set your API key
export ANTHROPIC_API_KEY="sk-ant-..."
Configuration
Inline
agents:
root:
model: anthropic/claude-sonnet-4-0
Named Model
models:
claude:
provider: anthropic
model: claude-sonnet-4-0
max_tokens: 64000
Available Models
| Model | Best For |
|---|---|
claude-sonnet-4-5 |
Most capable, extended thinking |
claude-sonnet-4-0 |
Strong coding, balanced performance |
Thinking Budget
Anthropic uses integer token budgets (1024–32768). Defaults to 8192 with interleaved thinking enabled:
models:
claude-deep:
provider: anthropic
model: claude-sonnet-4-5
thinking_budget: 16384 # must be < max_tokens
Interleaved Thinking
Enabled by default. Allows tool calls during model reasoning for more integrated problem-solving:
models:
claude:
provider: anthropic
model: claude-sonnet-4-5
provider_opts:
interleaved_thinking: false # disable if needed
ℹ️ Note
Anthropic thinking budget values below 1024 or greater than or equal to max_tokens are ignored (a warning is logged).