Quickstart
This guide gets you from zero to seeing LLM traces in your Promptic dashboard.
Install the SDK
pip install promptic-sdk[openai]Replace [openai] with the extra that matches your stack (e.g. [anthropic],
[bedrock], [vertexai], [mistralai], [langchain], [openai-agents],
[claude-agent]), or use [all] to install every supported instrumentor. See
Installation for the full list.
Get your AI Application API key
Open your AI Application in the Promptic dashboard, go to Settings → API Keys, and create a new API key. Set it as an environment variable:
export PROMPTIC_API_KEY="ptc_..."If you run against a self-hosted or demo deployment, also set the endpoint:
export PROMPTIC_ENDPOINT="https://your-promptic-host"Add two lines to your code
import promptic_sdk
promptic_sdk.init(service_name="support-api")Call init() once at startup, before any LLM calls. The API key assigns traces to the AI
Application and service_name identifies the emitting workload.
For production, also set the standard OpenTelemetry deployment environment:
export OTEL_RESOURCE_ATTRIBUTES="deployment.environment.name=production"Optionally attribute spans to a component
Wrap relevant calls in an ai_component context when you want to connect spans to an existing AI
Component. A trace does not require a component and may contain several:
import promptic_sdk
from openai import OpenAI
promptic_sdk.init(service_name="classifier-api")
client = OpenAI()
with promptic_sdk.ai_component("my-classifier"):
response = client.chat.completions.create(
model="gpt-4.1-nano",
messages=[{"role": "user", "content": "Is this email spam? ..."}],
)
print(response.choices[0].message.content)View your traces
Open Tracing in the Promptic dashboard. The global explorer shows recent traces and lets you filter by AI Application, service, environment, and optional component attribution.
Before enabling production traffic, inspect a trace for sensitive or unnecessary attributes. See Security and data handling.
What's next?
Now that tracing is set up, explore what you can do:
- Tracing guide — Multi-provider setup and advanced configuration
- Prompt Optimization — Automatically find the best prompt for your task
- Deployment — Deploy optimized prompts and fetch them at runtime