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.

Installation

pip install respan-exporter-anthropic-agents

Quickstart

import asyncio
from claude_agent_sdk import ClaudeAgentOptions
from respan_exporter_anthropic_agents.respan_anthropic_agents_exporter import (
    RespanAnthropicAgentsExporter,
)

exporter = RespanAnthropicAgentsExporter()

async def main() -> None:
    options = exporter.with_options(
        options=ClaudeAgentOptions(
            allowed_tools=["Read", "Glob", "Grep"],
            permission_mode="acceptEdits",
        )
    )

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

asyncio.run(main())

Configuration

Environment Variables

Variable Required Description
RESPAN_API_KEY Yes Your Respan API key.
RESPAN_BASE_URL No Base URL for all Respan services. Defaults to https://api.respan.ai.

RESPAN_BASE_URL is the single base URL that controls where telemetry is exported. The exporter automatically appends /api/v1/traces/ingest to build the full endpoint.

Constructor Parameters

All configuration can also be passed directly to the constructor.

Recommended pattern (matches the runnable examples):

exporter = RespanAnthropicAgentsExporter(
    api_key="your_respan_key",        # Optional; falls back to RESPAN_API_KEY
    base_url="https://api.respan.ai", # Optional; falls back to RESPAN_BASE_URL
)

Optional advanced override:

exporter = RespanAnthropicAgentsExporter(
    endpoint="https://custom-host/api/v1/traces/ingest",  # Full ingest URL
    timeout_seconds=15,
    max_retries=3,
    base_delay_seconds=1.0,
    max_delay_seconds=30.0,
)

Resolution order:

  • api_key: constructor api_key -> RESPAN_API_KEY
  • endpoint: constructor endpoint -> derived from constructor base_url -> derived from RESPAN_BASE_URL

Note: if both endpoint and base_url are provided, endpoint takes precedence.

Examples

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.10.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.10.tar.gz.

File metadata

File hashes

Hashes for respan_exporter_anthropic_agents-1.0.10.tar.gz
Algorithm Hash digest
SHA256 9a5bf603add3c2274f3286fdeef02603d63305b1271d5196d54003cb1b81773c
MD5 a2ded8574ea00201a169f166484438fb
BLAKE2b-256 825bcc7b1d9a64aed95cb440474a92e516b139a853c4de5e76d045669c65dbf1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for respan_exporter_anthropic_agents-1.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 dda9fd3fd0b14e1a50edf136b3188e1bca13adb3ed18f3e52baecd81508c1b83
MD5 0169ad0c86b639ba170ec93ce76cf2a8
BLAKE2b-256 19ae2763e4cc070582ad40e6540f22782b824ddf27cf4f430e3d3668761cab6c

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