Anthropic native LLM provider for AgentForge — Claude with caching, extended thinking, streaming
Project description
agentforge-anthropic
Anthropic native LLM provider for AgentForge.
Use this package when you want to call Claude directly via Anthropic's native API rather than through AWS Bedrock. Native access ships latest-model support, prompt caching, extended thinking, and per-token streaming the day Anthropic releases them.
Install
pip install "agentforge-anthropic[anthropic]"
The bare pip install agentforge-anthropic install keeps the
package importable for tests; the production runner needs the
anthropic SDK, which the [anthropic] extra pulls in.
Use
from agentforge import Agent
from agentforge_anthropic import AnthropicClient
# Direct instantiation
client = AnthropicClient.from_config(
model="claude-sonnet-4-7",
api_key="sk-ant-...", # or omit and use ANTHROPIC_API_KEY
)
# Or via Agent's resolver (recommended)
agent = Agent(model="anthropic:claude-sonnet-4-7")
Capabilities
AnthropicClient.capabilities() declares the closed-vocabulary set:
tools— Claude's tool-use APIjson_mode— JSON response format via system-prompt addendumcaching— prompt caching withcache_control: ephemeralblocksthinking— extended thinking viathinking={"type": "enabled", "budget_tokens": ...}streaming— per-token streaming viamessages.stream()
Callers gate optional methods on client.supports("capability")
before invoking — the additive contract in
ADR-0009.
Why a separate sister package from agentforge-bedrock?
Both implement the same LLMClient contract but talk to
different endpoints:
agentforge-bedrock— Bedrock Converse API; Anthropic models routed via AWS; cross-region inference profiles; AWS IAM auth.agentforge-anthropic— Anthropic native API; direct; bearer-token auth; faster access to new model releases.
A string-id swap ("bedrock:..." → "anthropic:...") is the
only change in caller code.
Testing
Production runner under # pragma: no cover wraps the
anthropic SDK. Unit tests inject a FakeAnthropicRunner (in
agentforge_anthropic._inmem_runner) that records every
messages_create call. Live integration tests are gated behind
pytest -m live and need a real ANTHROPIC_API_KEY.
License
Apache-2.0. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentforge_anthropic-0.2.1-py3-none-any.whl.
File metadata
- Download URL: agentforge_anthropic-0.2.1-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fbdb8c5d9ba22e1c8491acbd6805536cdd7cb522ecfaf7ac95262f59dd92116
|
|
| MD5 |
a7ee849b6f368bf37e827502ae7811e7
|
|
| BLAKE2b-256 |
949a27aad8d70a0f8e3648076d3a60b976bbbf729f332af272558f2d232742b3
|