Skip to main content
  1. Sign up — Create an account at platform.respan.ai
  2. Create an API key — Generate one on the API keys page
  3. Add credits or a provider key — Add credits on the Credits page or connect your own provider key on the Integrations page

What is Anthropic Agents?

The Anthropic Agent SDK enables building agent workflows powered by Claude. Use the Respan exporter to capture telemetry from agent runs and send traces to Respan.

Setup

1

Install packages

pip install respan-exporter-anthropic-agents
2

Set environment variables

.env
RESPAN_API_KEY=your-respan-api-key
# Optional (default: https://api.respan.ai)
RESPAN_BASE_URL=https://api.respan.ai
RESPAN_BASE_URL is the single base URL for all Respan services. The exporter automatically appends /api/v1/traces/ingest to build the full endpoint.
3

Initialize the exporter and run an agent

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

exporter = RespanAnthropicAgentsExporter()

async def main():
    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())
4

View your trace

Open the Traces page in the Respan dashboard. Your trace should appear within a few seconds.

Configuration

All configuration can be passed directly to the constructor (takes priority over environment variables).
exporter = RespanAnthropicAgentsExporter(
    api_key="your_respan_key",       # Overrides RESPAN_API_KEY
    base_url="https://api.respan.ai", # Overrides RESPAN_BASE_URL
    endpoint="https://custom/ingest", # Full endpoint URL (overrides base_url)
    timeout_seconds=15,
    max_retries=3,
    base_delay_seconds=1.0,
    max_delay_seconds=30.0,
)
ParameterRequiredDescription
api_keyNoYour Respan API key. Overrides RESPAN_API_KEY.
base_urlNoBase URL for Respan services. Overrides RESPAN_BASE_URL. Defaults to https://api.respan.ai.
endpointNoFull endpoint URL. Overrides base_url.
timeout_secondsNoRequest timeout in seconds.
max_retriesNoMaximum number of retry attempts.
base_delay_secondsNoBase delay between retries.
max_delay_secondsNoMaximum delay between retries.

Observability

With this integration, Respan auto-captures:
  • Agent runs — each agent execution as a span
  • LLM calls — model, input/output messages, token usage
  • Errors — failed runs and error details
View traces on the Traces page.