Respan instrumentation plugin for the Claude Agent SDK
Project description
respan-instrumentation-claude-agent-sdk
Respan instrumentation plugin for the Claude Agent SDK.
This package enables the Claude Agent SDK's native OpenTelemetry emission and normalizes those spans into the Respan/Traceloop conventions used by the OTLP pipeline.
Configuration
1. Install
pip install respan-instrumentation-claude-agent-sdk
2. Set Environment Variables
| Variable | Required | Description |
|---|---|---|
RESPAN_API_KEY |
Yes | Your Respan API key. Authenticates both proxy and tracing. |
RESPAN_BASE_URL |
No | Defaults to https://api.respan.ai/api. |
All vendor-specific variables (for example ANTHROPIC_API_KEY) are derived
from these in your application code.
Quickstart
3. Run Script
import asyncio
import os
import claude_agent_sdk
from claude_agent_sdk import ClaudeAgentOptions, ResultMessage
from respan import Respan
from respan_instrumentation_claude_agent_sdk import ClaudeAgentSDKInstrumentor
respan_api_key = os.environ["RESPAN_API_KEY"]
respan_base_url = os.getenv("RESPAN_BASE_URL", "https://api.respan.ai/api")
os.environ["ANTHROPIC_API_KEY"] = respan_api_key
os.environ["ANTHROPIC_AUTH_TOKEN"] = respan_api_key
os.environ["ANTHROPIC_BASE_URL"] = f"{respan_base_url}/anthropic"
respan = Respan(
api_key=respan_api_key,
base_url=respan_base_url,
instrumentations=[ClaudeAgentSDKInstrumentor(capture_content=True)],
)
async def main() -> None:
options = ClaudeAgentOptions(
model="sonnet",
max_turns=1,
permission_mode="bypassPermissions",
cwd=os.getcwd(),
env={
"ANTHROPIC_API_KEY": respan_api_key,
"ANTHROPIC_AUTH_TOKEN": respan_api_key,
"ANTHROPIC_BASE_URL": f"{respan_base_url}/anthropic",
},
)
async for message in claude_agent_sdk.query(
prompt="Reply with exactly hello_from_claude_sdk.",
options=options,
):
if isinstance(message, ResultMessage):
print(message.result)
asyncio.run(main())
respan.flush()
4. View Dashboard
After running the script, traces appear on your Respan dashboard.
Further Reading
See the python/tracing/claude-agent-sdk example for a runnable end-to-end workflow that covers tool use, multi-turn sessions, and edge cases.
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_claude_agent_sdk-0.1.0.tar.gz.
File metadata
- Download URL: respan_instrumentation_claude_agent_sdk-0.1.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24fbc9fa64ace15320115ecaabaed5c6e7b50e90adb72572ca4ab20d536db70d
|
|
| MD5 |
b7e772b6c89aea4df475634363bb83a3
|
|
| BLAKE2b-256 |
1ca816d03b613e1f60093bf55a650124e2ddfe2ea951eb1f1f85368d5e104497
|
Provenance
The following attestation bundles were made for respan_instrumentation_claude_agent_sdk-0.1.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_claude_agent_sdk-0.1.0.tar.gz -
Subject digest:
24fbc9fa64ace15320115ecaabaed5c6e7b50e90adb72572ca4ab20d536db70d - Sigstore transparency entry: 1338341999
- Sigstore integration time:
-
Permalink:
respanai/respan@c4880c0833070c2d2d8f1c014fd1345c1a0be1e7 -
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@c4880c0833070c2d2d8f1c014fd1345c1a0be1e7 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file respan_instrumentation_claude_agent_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: respan_instrumentation_claude_agent_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.3 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 |
6474c0b7e02ca6ffad86d5edbe4ca46bca671b8e07c1dacf154fadad3196b8a6
|
|
| MD5 |
b065175a2bc518921a6948846738ebf5
|
|
| BLAKE2b-256 |
7ffdabe198ee06b6ccdee79f1d919e0189e7a0536ec0049bd574e3b03240f189
|
Provenance
The following attestation bundles were made for respan_instrumentation_claude_agent_sdk-0.1.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_claude_agent_sdk-0.1.0-py3-none-any.whl -
Subject digest:
6474c0b7e02ca6ffad86d5edbe4ca46bca671b8e07c1dacf154fadad3196b8a6 - Sigstore transparency entry: 1338342063
- Sigstore integration time:
-
Permalink:
respanai/respan@c4880c0833070c2d2d8f1c014fd1345c1a0be1e7 -
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@c4880c0833070c2d2d8f1c014fd1345c1a0be1e7 -
Trigger Event:
workflow_run
-
Statement type: