agentkit-provider-anthropic
Anthropic Messages API provider for agentkit.
Connects the agent loop to https://api.anthropic.com/v1/messages (or any
compatible endpoint). Supports streaming, prompt caching, extended thinking,
and server-side tools (web search, web fetch, code execution).
Quick start
use ;
use ;
async
Environment variables
| Variable | Required | Default |
|---|---|---|
ANTHROPIC_API_KEY |
one of | — |
ANTHROPIC_AUTH_TOKEN |
one of | — (bearer token; takes precedence if set) |
ANTHROPIC_MODEL |
yes | — |
ANTHROPIC_MAX_TOKENS |
yes | — (required per-request by the API) |
ANTHROPIC_BASE_URL |
no | https://api.anthropic.com/v1/messages |
ANTHROPIC_VERSION |
no | 2023-06-01 |
ANTHROPIC_BETA |
no | comma-separated list of anthropic-beta tags |
Server tools
Known server tools (WebSearchTool, WebFetchTool, CodeExecutionTool, etc.)
implement the ServerTool trait. RawServerTool passes through any tool
type the crate does not yet cover.