Skip to main content

Agent Observability Python Provider Helper: Anthropic

agento11y-anthropic provides strict Anthropic Messages wrappers and mappers for agento11y.

Embeddings support

This helper currently supports Anthropic Messages APIs only. Native Anthropic embeddings endpoints are not available in the official SDK/API surface used in this repository.

Installation

pip install agento11y agento11y-anthropic anthropic

This package supports Anthropic Python SDK 0.79 through 1.x. SDK 1.x rejects temperature, top_p, and top_k as arguments to messages.create() and messages.stream(). Pass them through extra_body when an older model still needs them. The wrapper still records temperature and top_p when they are present on the request object it is given.

Wrapper Mode (Sync)

from anthropic.types.message_create_params import MessageCreateParams
from agento11y import Client, ClientConfig
from agento11y_anthropic import AnthropicOptions, messages

client = Client(ClientConfig())

request: MessageCreateParams = {
    "model": "claude-sonnet-4-5",
    "max_tokens": 256,
    "messages": [{"role": "user", "content": "Hello"}],
}

def provider_call(req: MessageCreateParams):
    return anthropic_client.messages.create(**req)

response = messages.create(
    client,
    request,
    provider_call,
    AnthropicOptions(conversation_id="conv-1", agent_name="assistant", agent_version="1.0.0"),
)

Wrapper Mode (Stream)

from agento11y_anthropic import AnthropicStreamSummary, messages

summary = messages.stream(
    client,
    request,
    lambda req: AnthropicStreamSummary(
        output_text="streamed text",
        events=[{"type": "content_block_delta", "delta": {"type": "text_delta", "text": "streamed text"}}],
    ),
)

Mapper Mode

generation = messages.from_request_response(request, response)
stream_generation = messages.from_stream(request, summary)

Raw Provider Artifacts (Opt-In)

options = AnthropicOptions(raw_artifacts=True)

Raw artifacts are default OFF and should only be enabled for diagnostics.

Provider metadata mapping

In addition to normalized usage fields, Anthropic server-tool counters are mapped into agento11y metadata when present:

  • agento11y.gen_ai.usage.server_tool_use.web_search_requests
  • agento11y.gen_ai.usage.server_tool_use.web_fetch_requests
  • agento11y.gen_ai.usage.server_tool_use.total_requests

Metadata

Release files for agento11y-anthropic 0.23.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 agento11y-anthropic 0.23.0
File Size Uploaded Provenance Actions
agento11y_anthropic-0.23.0.tar.gz 9.5 kB With provenance Details for agento11y_anthropic-0.23.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agento11y-anthropic 0.23.0
File Interpreter ABI Platform Actions
agento11y_anthropic-0.23.0-py3-none-any.whl Python 3 none any Details for agento11y_anthropic-0.23.0-py3-none-any.whl

Total release size: 16.8 kB

Release files / agento11y_anthropic-0.23.0.tar.gz

Download URL agento11y_anthropic-0.23.0.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
65189d992098c8c5038d54f5ec34c78b1b2490da8685bf84e21ffdc13d27b98f
BLAKE2b-256 checksum
How to use checksums
f44ab2f17d5fb38632a34a1932f2cb03367f3c3acbbb32a33d88e6e4fef64fdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 / agento11y_anthropic-0.23.0-py3-none-any.whl

Download URL agento11y_anthropic-0.23.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c1b59cc9dc1eecfb1d7d9ab37090e10f78026ec3803180010b26b562b3f4440
BLAKE2b-256 checksum
How to use checksums
ec917f2131843524ef9bc4ba791586b9f2de39ce13df4fee0f2639d93eaa717b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 agento11y-anthropic 0.23.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 agento11y_anthropic-0.23.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 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