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

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

Download files

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

Source Distribution

agento11y_anthropic-0.13.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

agento11y_anthropic-0.13.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file agento11y_anthropic-0.13.0.tar.gz.

File metadata

  • Download URL: agento11y_anthropic-0.13.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for agento11y_anthropic-0.13.0.tar.gz
Algorithm Hash digest
SHA256 a878e3c1f1ad6c8ed83ef6a525e97142c84f5894631659bcbc85d9ee769a2b39
MD5 1c2b7d4efaad6c646581b988ec6da3ed
BLAKE2b-256 5a3445a78b210b4dca2f9bf4e865718eaffba34e8a9481ac6473cd5a294973d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for agento11y_anthropic-0.13.0.tar.gz:

Publisher: python-sdks-publish.yml on grafana/agento11y

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

File details

Details for the file agento11y_anthropic-0.13.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agento11y_anthropic-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb877a65106dbb11d1c38adcc1375780c13ca4b073ef73331e1df2c021f6e821
MD5 35dd43e33f863ab8efb3d815ae22c85d
BLAKE2b-256 4a3a35428f698bf62f578cb086a7f5363f29516f00e001ea7eaf4775221c76f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for agento11y_anthropic-0.13.0-py3-none-any.whl:

Publisher: python-sdks-publish.yml on grafana/agento11y

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 Sentry Error logging StatusPage Status page