Choose how to integrate
| Approach | What it does | Use it when | Page |
|---|---|---|---|
| Agent Plugin | Use Claude Code or Cursor to find your tracing setup, creates the workspace, mints the API key and adds the Kubit SDK. It shows a diff before every change. | You work in Claude Code or Cursor, or you already send traces to Langfuse or Braintrust | Agent plugin |
| Kubit SDK | kubit-otel (Python) or @kubit-ai/otel (Node) sends spans with one configure() call. It drops spans that aren’t LLM-related and can mask content before export. | You want to wire it by hand with the least code | Python, Node |
| Manual OpenTelemetry | The stock OpenTelemetry SDK and OTLP/HTTP exporter, pointed at Kubit with an x-api-key header. No Kubit package. | You already run an OpenTelemetry pipeline, can’t add a dependency, or work in another language | Manual OpenTelemetry |
Before you start
- A Kubit account. Sign-up needs an early-access link from Kubit or an invite from your organization. See Set up your organization.
- An agent that calls an LLM, in Python 3.9 or later or Node.js 18 or later
- The Owner or Admin role, to create a workspace and API keys
Steps
1
Get an API key
Kubit authenticates spans with an ingestion API key, read from the
KUBIT_API_KEY environment variable. Each key belongs to one workspace.The app shows a new key only once:
This is the only time we'll show you this key. Copy it now. Copy it, or click Download for a .env file, then click I’ve Saved It. The downloaded file names the key KUBIT_OTEL_API_KEY, so rename it to KUBIT_API_KEY.Availability: API Keys shows only to the Owner and Admin roles, and only in Agent and User workspaces.Then set it in your shell for the next steps:2
Install the SDK
.env with python-dotenv, keep using it. Kubit reads KUBIT_API_KEY from the environment either way.3
Add the bootstrap file
Create Change
kubit_instrumentation.py next to your entrypoint:kubit_instrumentation.py
service_name, service_version and deployment.environment to match your app. Kubit uses them to tell agents and releases apart.4
Import it first in your entrypoint
Make it the first import in
main.py, app.py or whichever file starts your app, so the provider exists before any LLM client is created:main.py
5
Send a test span
From the folder that holds
kubit_instrumentation.py, run:force_flush() sends the span before the process exits. Without it, the span waits up to 5000 ms in the batch. The output includes this line on stderr:Output
endpoint=<from OTEL_EXPORTER_OTLP_*> is the label kubit-otel prints when you don’t pass endpoint. The SDK still sends to https://otel.kubit.ai/v1/traces.6
Trace your LLM calls
The test span proves the connection. To trace real agent work, add an OpenTelemetry GenAI instrumentor for your LLM client. For the OpenAI Python SDK:Then set this env var so spans carry the prompt and response text that Polaris labels:
kubit_instrumentation.py
1
Get an API key
Kubit authenticates spans with an ingestion API key, read from the
KUBIT_API_KEY environment variable. Each key belongs to one workspace.The app shows a new key only once:
This is the only time we'll show you this key. Copy it now. Copy it, or click Download for a .env file, then click I’ve Saved It. The downloaded file names the key KUBIT_OTEL_API_KEY, so rename it to KUBIT_API_KEY.Availability: API Keys shows only to the Owner and Admin roles, and only in Agent and User workspaces.2
Integrate with your approach
Follow the page for the approach you chose. Each page ends with a test span. Come back here once it’s sent.
Agent Plugin
/kubit-integrate in Claude Code or CursorKubit SDK for Python
kubit-otel with configure() or attach()Kubit SDK for Node
@kubit-ai/otel with configure() or KubitSpanProcessorManual OpenTelemetry
The stock OTLP/HTTP exporter, in Python or Node
3
Check the extraction mapping
The extraction mapping turns span attributes into the fields you filter and group by, such as LLM: Model and Client: User Id. Each workspace starts from a template. To check it against your own spans, open Data > Extraction.

- The summary bar shows the Template the mapping started from, its State (Pristine, or Customized after an edit) and the Event TS path. Use
default-agent. It reads the OpenTelemetry GenAI keys and the keys of Langfuse, LangSmith, the Vercel AI SDK, OpenInference, Traceloop, Braintrust and Mastra. A workspace created by/kubit-integratestarts ondefault-otel, which reads only the OpenTelemetry GenAI keys. To switch, click Change template, pickdefault-agentand click Apply template. Applying a template discards your path edits. - Click Run preview. The Raw payload panel loads up to 20 of your most recent spans, and the Sample column shows what each mapped column reads from the selected span.
- If a column you need is empty, click Edit on its row and add the attribute under Source paths. Kubit tries the paths in order and uses the first one with a value. To pick a path instead of typing it, use Pick a path from a recent payload below the list.
![Edit source dialog for USER_ID with four numbered Source paths: attributes['enduser.id'], attributes['user.id'], resource.attributes['enduser.id'] and resource.attributes['user.id'], an empty field to add another path, and Pick a path from a recent payload, 1 of 100.](https://mintcdn.com/kubit/1Fb-SAr-OHTiP1JA/images/agent-analytics/extraction-edit-source.png?fit=max&auto=format&n=1Fb-SAr-OHTiP1JA&q=85&s=5aaf84c99575b55cb9f73242c8831765)
- To use an attribute that has no column, such as
customer.plan, click Add custom field, set Name, Source paths and Type, and click Add field.
default-agent reads these keys for the fields most reports use, among others:Constraint: A column marked Replay only changes for new spans when you edit it. Existing rows keep their old value until you run a replay from Data > Pipeline.
4
Validate in Activity
First check that spans reach Kubit. Open Data > Pipeline. Under Streaming, Latest event received at shows when the newest span arrived, and Total events · 24H counts the last day. Before the first span arrives, the setup steps show 
Then look at the traces:
Waiting for first event to arrive.
- Open Agent > Activity.
- Keep Subject on Trace, keep Time Range on Last 1 Day and click Execute. Activity doesn’t load or refresh on its own. After a run, the header shows when it synced, and Refresh loads newer traces.

- Click your test trace. The header shows its Latency, Total cost, Tokens, User and Session. An empty User or Session means the extraction mapping found no ID for it. Click a span in the Timeline to see its Input, Output and Custom Fields on the Preview tab, or switch to JSON or Raw to see the span with every attribute.

Verify
You’re done when all three are true:- Data > Pipeline shows a Latest event received at time from after your test span.
- Agent > Activity lists your test trace after you click Execute.
- The trace header shows a User and a Session, if you set those IDs, and the fields you need have values. If one is empty, go back to Check the extraction mapping.
If it fails
Next Steps
- Concepts: users, sessions, traces, spans and what Polaris labels.
- Is my data flowing?: step-by-step checks when spans don’t arrive.
- Agent plugin: query traces and reports from Claude Code or Cursor.