SDK Quickstart
SDKGet started with Traccia SDK in under 5 minutes.
This guide will help you install the Traccia SDK and start tracing your AI agents locally. You'll be able to export traces to any OpenTelemetry-compatible backend like Jaeger, Grafana Tempo, or Zipkin.
Platform by default
api.traccia.ai). Set TRACCIA_API_KEY and call init() to use the platform. This quickstart uses local tracing (console or local OTLP) so you can try the SDK without an account. For the full platform, see Platform Getting Started. If you use the platform, see Agent identity to set agent and environment so traces are easy to find.1Install the SDK
Install Traccia using pip:
pip install traccia2Initialize Traccia
Add initialization at the start of your application. For this quickstart we use the console exporter so you can see traces in your terminal without any extra setup:
from traccia import init
# Console output so you can see traces in the terminalinit(enable_console_exporter=True)
# Or: local Jaeger — init(endpoint="http://localhost:4318/v1/traces")# Or: Traccia platform — set TRACCIA_API_KEY and init()3Instrument Your Code
Use the @observe() decorator to trace any function. Use the same init() as in step 2 so traces show up in the console:
from traccia import init, observefrom openai import OpenAI
# Same init as step 2 — console exporter for this quickstartinit(enable_console_exporter=True)
# Then create clientclient = OpenAI()
@observe()def research_agent(topic: str) -> str: """Research agent that gathers information on a topic.""" # This LLM call is automatically traced response = client.chat.completions.create( model="gpt-4", messages=[ {"role": "system", "content": "You are a research assistant."}, {"role": "user", "content": f"Research: {topic}"} ] ) return response.choices[0].message.content
# Run your agentresult = research_agent("quantum computing")print(result)4View Your Traces
With the console exporter (from step 2), you'll see trace output in your terminal:
[Traccia] Trace: research_agent├── Span: research_agent (duration: 2.4s)│ ├── model: gpt-4│ ├── tokens: 450 (prompt: 45, completion: 405)│ ├── cost: $0.0135│ └── status: successWhat just happened?
Function tracing
The @observe() decorator automatically created a parent span for your agent.
Auto-instrumentation
The OpenAI call was automatically intercepted and traced as a child span.
Token tracking
Token counts and estimated costs were automatically attached to the OpenAI span.
Data Capture & PII Redaction
skip_args on the @observe() decorator. See Security for configuration options.Next Steps
© 2026 Traccia.