Skip to main content

agentos-provider-anthropic

AgentOS executor for the Anthropic Messages API wire format — Anthropic's own API, and Ollama's /v1/messages, which serves the same shape locally. Plain httpx, no SDK.

This is the second provider, and its job is to prove the plugin seam: a different request/response shape, a different error envelope ({"type":"error","error":{…}}, including 529 overloaded_error), a different auth header (x-api-key + anthropic-version) — and zero changes to the core or to the OpenAI provider. An agent moves between the two by changing one field, executor.

pip install -e . -e providers/anthropic          # from the AgentOS checkout

Agent definition

Identical vocabulary to openai-compat:

{"name": "poet", "type": "llm", "executor": "anthropic",
 "config": {"model": "chat.fast", "system": "You are a terse poet.",
            "prompt": "Write a haiku about {run.topic}."}}
config key meaning default
model alias (chat.fast) or concrete id (claude-3-5-haiku-latest) chat.default
system sent as the top-level system field none
prompt user-message template; {run.x}, {step.field} inputs as JSON
temperature 0
max_tokens the Messages API requires it 1024
json_output the API has no response_format; an instruction is appended to system and fences are stripped before parsing false

Environment

variable default notes
AGENTOS_ANTHROPIC_BASE_URL http://127.0.0.1:11434 no /v1 — the path is /v1/messages; Anthropic: https://api.anthropic.com
AGENTOS_ANTHROPIC_API_KEY unset (falls back to ANTHROPIC_API_KEY) Ollama needs none
AGENTOS_ANTHROPIC_VERSION 2023-06-01 anthropic-version header
AGENTOS_ANTHROPIC_ALIASES {"chat.fast": "qwen2.5:0.5b", "chat.default": "llama3.2:3b"} for Anthropic: e.g. {"chat.fast": "claude-3-5-haiku-latest"}
AGENTOS_ANTHROPIC_PRICING / _TIMEOUT / _CASSETTES / _CASSETTE_DIR / _CASSETTE as in the OpenAI provider

What a step records

Same as the OpenAI provider (output.text/model/alias/finish_reason/usage/priced[/json], metered cost, provenance), plus a cached_input_tokens meter when the server reports cache reads/writes. Cached tokens are counted inside input_tokens at the full input rate — conservative for Anthropic's 10 % cache-read price — and recorded separately so the discount is recoverable from the log.

Testing

Cassettes in tests/cassettes/ were recorded from a real Ollama (qwen2.5:0.5b) via /v1/messages; the shared scenarios live in dagentos.providerkit.conformance. tests/anthropic_reference_server.py fakes 401 / 429 / 529. Re-record: python scripts/record_cassettes.py --live. The nightly provider-live workflow re-records both providers on a runner and replays.

Status

0.1.0. MIT.

Metadata

Release files for agentos-provider-anthropic 0.17.1

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

Source distribution (sdist)

Source distribution for agentos-provider-anthropic 0.17.1
File Size Uploaded Provenance Actions
agentos_provider_anthropic-0.17.1.tar.gz 10.8 kB With provenance Details for agentos_provider_anthropic-0.17.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agentos-provider-anthropic 0.17.1
File Interpreter ABI Platform Actions
agentos_provider_anthropic-0.17.1-py3-none-any.whl Python 3 none any Details for agentos_provider_anthropic-0.17.1-py3-none-any.whl

Total release size: 20.5 kB

Release files / agentos_provider_anthropic-0.17.1.tar.gz

Download URL agentos_provider_anthropic-0.17.1.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ddb6aec8fe6c324825fd3e02b9562f70d232c95d840485cf3f659abfd9cb0b73
BLAKE2b-256 checksum
How to use checksums
d5c6200f53550c3db6673820f9367366939d669222d2f57353d81c3e54a02bfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 16, 2026.

Transparency log

Release files / agentos_provider_anthropic-0.17.1-py3-none-any.whl

Download URL agentos_provider_anthropic-0.17.1-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e6d170d817abd7792de23c7e97a6c161b942258519417266d7b4c61cf0e967b
BLAKE2b-256 checksum
How to use checksums
01a9f90aeda41614407362367b78075f4b293e23241afd7d02ee981cd726e822
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 16, 2026.

Transparency log

Security for agentos-provider-anthropic 0.17.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agentos_provider_anthropic-0.17.1.tar.gz

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 Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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