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

Versioned with the core (pyproject.toml here matches the root; docs/RELEASING.md "Versions"). MIT.

Metadata

Release files for agentos-provider-anthropic 0.18.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 agentos-provider-anthropic 0.18.0
File Size Uploaded Provenance Actions
agentos_provider_anthropic-0.18.0.tar.gz 11.0 kB With provenance Details for agentos_provider_anthropic-0.18.0.tar.gz

Built distribution (wheel)

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

Total release size: 20.9 kB

Release files / agentos_provider_anthropic-0.18.0.tar.gz

Download URL agentos_provider_anthropic-0.18.0.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a4c27be944d4ae765f4db6c2c391f01d7acbe619f0ffacb30abee9a0b2248e38
BLAKE2b-256 checksum
How to use checksums
a5730bb90f43a539f639d26cf50cb0300c91d12161d642195aed31ac9b2b88b9
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 18, 2026.

Transparency log

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

Download URL agentos_provider_anthropic-0.18.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f57c1138dabbac8516a2754d5fd5b23fcc7f9d7393cee296b9e97f2bcf445379
BLAKE2b-256 checksum
How to use checksums
67ae6a10adbda0c4457c2503cee29b33270cc5d3546b71d07370ebc6d8fdaabd
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 18, 2026.

Transparency log

Security for agentos-provider-anthropic 0.18.0

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.18.0.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 18, 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