Skip to main content

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 API
  • json_mode — JSON response format via system-prompt addendum
  • caching — prompt caching with cache_control: ephemeral blocks
  • thinking — extended thinking via thinking={"type": "enabled", "budget_tokens": ...}
  • streaming — per-token streaming via messages.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.

Metadata

Release files for agentforge-anthropic 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentforge-anthropic 0.4.0
File Size Uploaded
agentforge_anthropic-0.4.0.tar.gz 17.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentforge-anthropic 0.4.0
File Interpreter ABI Platform
agentforge_anthropic-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 34.0 kB

Release files / agentforge_anthropic-0.4.0.tar.gz

Download URL agentforge_anthropic-0.4.0.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bd299657025f19da360f397cc746b7047b56506d9b0eb9c58309568a81759b6e
BLAKE2b-256 checksum
How to use checksums
7529db64242530ffc21b6a74e935fd2895ae798a6e4f64444c1d434f1529035a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.

Transparency log

Release files / agentforge_anthropic-0.4.0-py3-none-any.whl

Download URL agentforge_anthropic-0.4.0-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85effcf430cadcb91512deca6facafda2a95af6e8cbbfa6f153dd4c1a4fa8e21
BLAKE2b-256 checksum
How to use checksums
f564f9d13a1430f20063fe71e30b6f343e7c29d37e692900d8b219fa76af2202
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page