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.
Metadata
Release files for respan-instrumentation-claude-agent-sdk 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| respan_instrumentation_claude_agent_sdk-0.2.1.tar.gz | 13.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| respan_instrumentation_claude_agent_sdk-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.1 kB
Release files / respan_instrumentation_claude_agent_sdk-0.2.1.tar.gz
| Download URL | respan_instrumentation_claude_agent_sdk-0.2.1.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e1ed97cf5047a522a1281b08608f4efffc17680c1c49d0443c7a0c04f607f37
|
|
BLAKE2b-256 checksum How to use checksums |
be6cc92e69aa6abb007e5a5922059cca9ca72308356254f2710e23c2b0537ff4
|
| 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 Aug 21, 2026.
Transparency logRelease files / respan_instrumentation_claude_agent_sdk-0.2.1-py3-none-any.whl
| Download URL | respan_instrumentation_claude_agent_sdk-0.2.1-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95e277334767f5c0d51141b1f815bb1e0290d1425673e05e0c4df8e006f7bfa5
|
|
BLAKE2b-256 checksum How to use checksums |
bd7e3203ac6e495f56bf9976a28703710ad2b42d747c2570c2777b414f776105
|
| 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 Aug 21, 2026.
Transparency log