Skip to main content

Exporter for Anthropic Agent SDK telemetry to Respan

Project description

Respan Exporter for Anthropic Agent SDK

respan.ai | Documentation

Exporter for Anthropic Agent SDK telemetry to Respan.

Respan is a proxy and tracing platform. Your Respan API key authenticates both LLM inference (proxy) and telemetry export (tracing).

Configuration

1. Install

pip install claude-agent-sdk respan-exporter-anthropic-agents

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.
export RESPAN_API_KEY=your_respan_key
# export RESPAN_BASE_URL=https://api.respan.ai  # default, only override if self-hosting

That's it. Everything else is derived:

  • Proxy: ANTHROPIC_BASE_URL = RESPAN_BASE_URL + /api/anthropic
  • Auth: ANTHROPIC_API_KEY = RESPAN_API_KEY
  • Tracing: The exporter reads RESPAN_API_KEY and RESPAN_BASE_URL automatically.

Quickstart

3. Run Script

Save this as quickstart.py:

import asyncio
import os
from claude_agent_sdk import ClaudeAgentOptions
from respan_exporter_anthropic_agents import RespanAnthropicAgentsExporter

respan_api_key = os.environ["RESPAN_API_KEY"]
respan_base_url = os.getenv("RESPAN_BASE_URL", "https://api.respan.ai")

exporter = RespanAnthropicAgentsExporter()

async def main() -> None:
    options = exporter.with_options(
        options=ClaudeAgentOptions(
            allowed_tools=["Read", "Glob", "Grep"],
            permission_mode="acceptEdits",
            env={
                "ANTHROPIC_API_KEY": respan_api_key,
                "ANTHROPIC_BASE_URL": f"{respan_base_url}/api/anthropic",
            },
        )
    )

    async for message in exporter.query(
        prompt="Analyze this repository and summarize architecture.",
        options=options,
    ):
        print(message)

asyncio.run(main())

Run it:

python quickstart.py

4. View Dashboard

Open:

  • https://platform.respan.ai/platform/traces

Further Reading

Runnable examples with full setup instructions:

Dev Guide

Running Tests

# Unit tests
python -m unittest tests.test_exporter -v

# Live integration test (opt-in, makes real API calls)
export RESPAN_API_KEY="your_respan_key"
export IS_REAL_GATEWAY_TESTING_ENABLED=1
python -m unittest tests.test_real_gateway_integration -v

Project details


Download files

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

Source Distribution

respan_exporter_anthropic_agents-1.0.16.tar.gz (9.3 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_exporter_anthropic_agents-1.0.16.tar.gz.

File metadata

File hashes

Hashes for respan_exporter_anthropic_agents-1.0.16.tar.gz
Algorithm Hash digest
SHA256 6b48070a2350c361019c02eb0b07296f40b2e5ff10740e987e8bcb2e503fd074
MD5 299a4086bbda36b5f8fd514c8a9332e8
BLAKE2b-256 e5b4e76679be5b5a6748ea7173b26fe1628e4b3c8023a737b3b4ad79f092870b

See more details on using hashes here.

File details

Details for the file respan_exporter_anthropic_agents-1.0.16-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_exporter_anthropic_agents-1.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 cfd65d9967fccbdd633f57e3787e552ffd1157ec9404ad8ae61cd67a8587ebfc
MD5 9a4877d79ebdfdd00683b1f7a90b126d
BLAKE2b-256 aa5b3aeecd7a5ee048904d292ac9146b58b98c6e23c835b013faa422aaf887d9

See more details on using hashes here.

Supported by

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