Respan instrumentation plugin for the Anthropic SDK
Project description
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
AnthropicandAsyncAnthropic. messages.create()and streaming responses are traced.- Managed agent session streaming is also captured when available through the Anthropic SDK.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file respan_instrumentation_anthropic-1.0.0.tar.gz.
File metadata
- Download URL: respan_instrumentation_anthropic-1.0.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a18c0fbe4cda3d517cdb99049134ecd4c20d68d79017e1194c53fc9673c5dfd8
|
|
| MD5 |
503bd462c45fb12ec10f59cd443924ae
|
|
| BLAKE2b-256 |
c29a9afccc4fb7bc840ec7c2a41aaac14031792465b7285ddfb0833feaa3e3c4
|
Provenance
The following attestation bundles were made for respan_instrumentation_anthropic-1.0.0.tar.gz:
Publisher:
publish.yml on respanai/respan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
respan_instrumentation_anthropic-1.0.0.tar.gz -
Subject digest:
a18c0fbe4cda3d517cdb99049134ecd4c20d68d79017e1194c53fc9673c5dfd8 - Sigstore transparency entry: 1267217198
- Sigstore integration time:
-
Permalink:
respanai/respan@36d3034eee7c63cfca48c227787dff0f6ed3d6e3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/respanai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@36d3034eee7c63cfca48c227787dff0f6ed3d6e3 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file respan_instrumentation_anthropic-1.0.0-py3-none-any.whl.
File metadata
- Download URL: respan_instrumentation_anthropic-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15738c9d7854334b90781527f260d42672ce2123e4925852714c561a9b7c5cac
|
|
| MD5 |
ae0454e02436e1e8a062cee95609cc00
|
|
| BLAKE2b-256 |
48d82089ee92302f30321503461ed034324f0bb70effd494b4a9de9a08ac65d9
|
Provenance
The following attestation bundles were made for respan_instrumentation_anthropic-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on respanai/respan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
respan_instrumentation_anthropic-1.0.0-py3-none-any.whl -
Subject digest:
15738c9d7854334b90781527f260d42672ce2123e4925852714c561a9b7c5cac - Sigstore transparency entry: 1267217263
- Sigstore integration time:
-
Permalink:
respanai/respan@36d3034eee7c63cfca48c227787dff0f6ed3d6e3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/respanai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@36d3034eee7c63cfca48c227787dff0f6ed3d6e3 -
Trigger Event:
workflow_run
-
Statement type: