Promptic

Quickstart

This guide gets you from zero to seeing LLM traces in your Promptic dashboard.

Install the SDK

Terminal
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:

Terminal
export PROMPTIC_API_KEY="ptc_..."

If you run against a self-hosted or demo deployment, also set the endpoint:

Terminal
export PROMPTIC_ENDPOINT="https://your-promptic-host"

Add two lines to your code

Python
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:

Terminal
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:

Python
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: