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.

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

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:

from respan import Respan
from respan_instrumentation_openai_agents import OpenAIAgentsInstrumentor
respan = Respan(
api_key="your-api-key",
instrumentations=[OpenAIAgentsInstrumentor()],
)

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:

from respan import (
# Core
Respan,
Instrumentation,
# Decorators
workflow, task, agent, tool,
# Client
RespanClient, get_client,
# Context managers
propagate_attributes,
respan_span_attributes,
)

Next steps