Skip to main content

respan-instrumentation-anthropic

Respan instrumentation plugin for the Anthropic Python SDK.

This package patches Anthropic client calls and emits spans using the Respan/Traceloop GenAI attribute shape used across this repository.

Install

pip install respan-instrumentation-anthropic

Quickstart

import os

from anthropic import Anthropic
from respan import Respan
from respan_instrumentation_anthropic import AnthropicInstrumentor

respan = Respan(
    api_key=os.environ["RESPAN_API_KEY"],
    instrumentations=[AnthropicInstrumentor()],
)

client = Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])

message = client.messages.create(
    model="claude-3-5-haiku-latest",
    max_tokens=128,
    messages=[{"role": "user", "content": "Write one line about tracing."}],
)

print(message.content)
respan.flush()

Notes

  • The instrumentor patches both Anthropic and AsyncAnthropic.
  • messages.create() and streaming responses are traced.
  • Managed agent session streaming is also captured when available through the Anthropic SDK.

Download files

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

Source Distribution

respan_instrumentation_anthropic-1.0.3.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file respan_instrumentation_anthropic-1.0.3.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_anthropic-1.0.3.tar.gz
Algorithm Hash digest
SHA256 bac8a46981ee6dc5525b0456a2780a9f5950dc34a42d0c85c8fe146555dc67dc
MD5 e8c3f996c7c10d41ac94c0d3802aedcb
BLAKE2b-256 ea3ea2dd0ba1d3e6d9592c8991d8f2419c41cf2d78a77ae2c9ab1e6fa890c8a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for respan_instrumentation_anthropic-1.0.3.tar.gz:

Publisher: publish.yml on respanai/respan

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

File details

Details for the file respan_instrumentation_anthropic-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_anthropic-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e7dec85491a3d1ce0ccc2787724c245ba1b9708096f7d5493307f7d5a2241220
MD5 4d4b8aa58dcbe339a1dd424ea589ae15
BLAKE2b-256 c5ea85eb6dee050c4a00d1c0430c2eee07560b229296c2dc7881e0e9e03471db

See more details on using hashes here.

Provenance

The following attestation bundles were made for respan_instrumentation_anthropic-1.0.3-py3-none-any.whl:

Publisher: publish.yml on respanai/respan

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

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page