Quickstart

Overview

respan is the recommended way to use Respan. It provides a single Respan() class that initializes tracing, captures LLM calls, and exposes decorators for structured spans.

$pip install respan-ai

Version: 3.0.0 | Python: >=3.9, <4.0

Quick start

With auto_instrument=True, Respan auto-traces any installed LLM SDK (OpenAI, Anthropic, LangChain, vector DBs, and more) — no instrumentor imports required.

1from respan import Respan
2
3respan = Respan(api_key="your-api-key", auto_instrument=True)
4
5from openai import OpenAI
6OpenAI().chat.completions.create(
7 model="gpt-4o",
8 messages=[{"role": "user", "content": "Hello"}],
9)

That’s it — the call above appears in your Respan dashboard.

Explicit instrumentation (optional)

Prefer to pin a specific instrumentation plugin (for finer control or to avoid auto-discovering a library you don’t want traced)? Pass it via instrumentations:

1from respan import Respan
2from respan_instrumentation_openai_agents import OpenAIAgentsInstrumentor
3
4respan = Respan(
5 api_key="your-api-key",
6 instrumentations=[OpenAIAgentsInstrumentor()],
7)

You can combine auto_instrument=True with explicit plugins — plugins take precedence.

See Respan() for every constructor parameter, environment variables, and more examples.

Public exports

Everything you need is available from respan:

1from respan import (
2 # Core
3 Respan,
4 Instrumentation,
5
6 # Decorators
7 workflow, task, agent, tool,
8
9 # Client
10 RespanClient, get_client,
11
12 # Context managers
13 propagate_attributes,
14 respan_span_attributes,
15)

Next steps