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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentos_provider_anthropic-0.17.0.tar.gz | 10.8 kB | With provenance | Details for agentos_provider_anthropic-0.17.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentos_provider_anthropic-0.17.0-py3-none-any.whl | Python 3 | none | any | Details for agentos_provider_anthropic-0.17.0-py3-none-any.whl |
Total release size: 20.5 kB
Release files / agentos_provider_anthropic-0.17.0.tar.gz
| Download URL | agentos_provider_anthropic-0.17.0.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b67e3669504132f764383be6d1b509eec1e938db1f16afac8208628f08ff06c7
|
|
BLAKE2b-256 checksum How to use checksums |
3c3e400afb74ba9f19ef110f3d94132a08295b067d80720ef21da4a0abd6ffa1
|
| 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 logRelease files / agentos_provider_anthropic-0.17.0-py3-none-any.whl
| Download URL | agentos_provider_anthropic-0.17.0-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3469847d8664a8f91e889956c7f266951c1ffd45dc22d0a55294a16a004e743a
|
|
BLAKE2b-256 checksum How to use checksums |
bfd64ee811f632c4a1c11b570c9c3af6b89fb01064c1278d6653104787acf0fb
|
| 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 logSecurity for agentos-provider-anthropic 0.17.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.
Attestation for agentos_provider_anthropic-0.17.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 16, 2026.
Transparency logA 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.