Skip to main content

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 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentforge_anthropic-0.3.0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentforge_anthropic-0.3.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file agentforge_anthropic-0.3.0.tar.gz.

File metadata

  • Download URL: agentforge_anthropic-0.3.0.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentforge_anthropic-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a131a08ec815a658dbe1ebf0a96adb138b05144cb1cf2bbe1f9e761db4f40650
MD5 cb88d627c113b4572aa87a3d74ca30e7
BLAKE2b-256 77b98a10f8ce8a82d1127298e8cf21c8364086c1d5f8676292901e242d9bbd53

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentforge_anthropic-0.3.0.tar.gz:

Publisher: release.yml on Scaffoldic/agentforge-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentforge_anthropic-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentforge_anthropic-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 725b16e0a37d4fae845494b18b391d0b4c3a28a5fbf8e2f921094607f62f259b
MD5 2077a036e41f96bb8560981d210deb7a
BLAKE2b-256 b55c538b52e9f0c0946cac1b7697d25078ab38ff8d7af05ed585e7a153cc9edb

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentforge_anthropic-0.3.0-py3-none-any.whl:

Publisher: release.yml on Scaffoldic/agentforge-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page