> ## Documentation Index
> Fetch the complete documentation index at: https://learn.kubit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart: send your first traces

> Pick one of three ways to send agent traces to Kubit, then check the extraction mapping and see your first traces in Activity.

Kubit reads your agent's OpenTelemetry traces. If they are not already in your cloud data warehouse, you can send them in three ways, each works for Python and Node. This quickstart helps you pick one, then covers the steps every approach shares: creating an Agent workspace, checking how your span attributes map to fields and finding your first traces in Activity. It takes about 15 minutes.

## Choose how to integrate

<table>
  <colgroup>
    <col width="157" />

    <col width="317" />

    <col width="274" />

    <col width="216" />
  </colgroup>

  <thead>
    <tr>
      <th>**Approach**</th>
      <th>**What it does**</th>
      <th>**Use it when**</th>
      <th>**Page**</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>**Agent Plugin**</td>
      <td>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.</td>
      <td>You work in Claude Code or Cursor, or you already send traces to Langfuse or Braintrust</td>
      <td>[Agent plugin](https://learn.kubit.ai/agent-analytics/integrate/agent-plugin.md)</td>
    </tr>

    <tr>
      <td>**Kubit SDK**</td>
      <td>`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.</td>
      <td>You want to wire it by hand with the least code</td>
      <td>[Python](https://learn.kubit.ai/agent-analytics/integrate/sdk-python.md), [Node](https://learn.kubit.ai/agent-analytics/integrate/sdk-node.md)</td>
    </tr>

    <tr>
      <td>**Manual OpenTelemetry**</td>
      <td>The stock OpenTelemetry SDK and OTLP/HTTP exporter, pointed at Kubit with an `x-api-key` header. No Kubit package.</td>
      <td>You already run an OpenTelemetry pipeline, can't add a dependency, or work in another language</td>
      <td>[Manual OpenTelemetry](https://learn.kubit.ai/agent-analytics/cookbook/manual-otel.md)</td>
    </tr>
  </tbody>
</table>

The agent plugin writes the same code you'd write with the Kubit SDK, so you can switch between the two later. With manual OpenTelemetry, every span your app records goes to Kubit, including HTTP and database spans. Filter them in your app's OTel Exporter or with the workspace's filter rules in **Data** > **Collection** > **Filtering**.

## 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](https://learn.kubit.ai/start-here/admin.md).
* [ ] 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.

| **Way to get a key** | **How** |
| - | - |
| **Coding agent** | Run `/kubit-integrate` in Claude Code or Cursor. It creates or selects a workspace, mints a key and writes `KUBIT_API_KEY` to `.env.local` or `.env`. See [Agent plugin](https://learn.kubit.ai/agent-analytics/integrate/agent-plugin.md). |
| **Kubit app** | Go to **Settings** > **Workspace** > **API Keys** and click **Generate API Key**. Add an optional **Note** (up to 50 characters) and click **Generate**. |

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.

> [!WARNING]
>
> Keep the key out of source control. Put it in `.env` or your secrets manager, and check that `.env` is in `.gitignore`.

Then set it in your shell for the next steps:

```bash theme={null}
export KUBIT_API_KEY=<your-key>
```

**2. Install the SDK**

```bash theme={null}
pip install kubit-otel
```

If your app reads `.env` with `python-dotenv`, keep using it. Kubit reads `KUBIT_API_KEY` from the environment either way.

**3. Add the bootstrap file**

Create `kubit_instrumentation.py` next to your entrypoint:

```python kubit_instrumentation.py theme={null}
import os
from kubit_otel import configure

configure(
    api_key=os.environ["KUBIT_API_KEY"],
    service_name="support-agent",
    service_version="1.0.0",
    resource_attributes={"deployment.environment": "dev"},
)
```

Change `service_name`, `service_version` and `deployment.environment` to match your app. Kubit uses them to tell agents and releases apart.

> [!WARNING]
>
> If your app already creates an OpenTelemetry `TracerProvider`, call `attach()` after `trace.set_tracer_provider()` instead of `configure()`. A `configure()` call that runs before your app sets its provider registers Kubit's provider first, and your app's provider is never registered. See [Kubit SDK for Python](https://learn.kubit.ai/agent-analytics/integrate/sdk-python.md#you-already-have-a-tracerprovider).

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

```python main.py theme={null}
import kubit_instrumentation  # must be the first import

# your existing imports and code follow
```

**5. Send a test span**

From the folder that holds `kubit_instrumentation.py`, run:

```bash theme={null}
KUBIT_API_KEY=<your-key> python -c "
import kubit_instrumentation
from opentelemetry import trace
trace.get_tracer('kubit-sdk').start_span('hello-kubit').end()
trace.get_tracer_provider().force_flush()
"
```

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

```text Output theme={null}
[kubit-otel info] kubit_otel configured  mode=registered service_name=support-agent service_version=1.0.0 endpoint=<from OTEL_EXPORTER_OTLP_*>
```

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

```bash theme={null}
pip install opentelemetry-instrumentation-openai-v2
```

```python kubit_instrumentation.py theme={null}
import os
from kubit_otel import configure
from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor

configure(
    api_key=os.environ["KUBIT_API_KEY"],
    service_name="support-agent",
    service_version="1.0.0",
    resource_attributes={"deployment.environment": "dev"},
)
OpenAIInstrumentor().instrument()
```

Then set this env var so spans carry the prompt and response text that Polaris labels:

```bash theme={null}
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true
```

**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.

| **Way to get a key** | **How** |
| - | - |
| **Coding agent** | Run `/kubit-integrate` in Claude Code or Cursor. It creates or selects a workspace, mints a key and writes `KUBIT_API_KEY` to `.env.local` or `.env`. See [Agent plugin](https://learn.kubit.ai/agent-analytics/integrate/agent-plugin.md). |
| **Kubit app** | Go to **Settings** > **Workspace** > **API Keys** and click **Generate API Key**. Add an optional **Note** (up to 50 characters) and click **Generate**. |

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.

> [!WARNING]
>
> Keep the key out of source control. Put it in `.env` or your secrets manager, and check that `.env` is in `.gitignore`.

**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.

> [card] [Agent Plugin](https://learn.kubit.ai/agent-analytics/integrate/agent-plugin.md)
>
> `/kubit-integrate` in Claude Code or Cursor

> [card] [Kubit SDK for Python](https://learn.kubit.ai/agent-analytics/integrate/sdk-python.md)
>
> `kubit-otel` with `configure()` or `attach()`

> [card] [Kubit SDK for Node](https://learn.kubit.ai/agent-analytics/integrate/sdk-node.md)
>
> `@kubit-ai/otel` with `configure()` or `KubitSpanProcessor`

> [card] [Manual OpenTelemetry](https://learn.kubit.ai/agent-analytics/cookbook/manual-otel.md)
>
> 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**.

![Extraction Mappings section with the summary bar showing TEMPLATE default-otel, STATE Pristine and EVENT TS start\_time next to Change template. The grid lists NAME, PARENT\_OBSERVATION\_ID, START\_TIME, USER\_ID, SESSION\_ID and ERROR\_CODE with their Category, Type, Source paths and Sample values. The Raw payload panel on the right shows a recent span, 1 of 20, with its attributes expanded, including gen\_ai.conversation.id, gen\_ai.tool.name, kubit.sdk.name, session.id and user.id.](https://mintcdn.com/kubit/1Fb-SAr-OHTiP1JA/images/agent-analytics/extraction-mappings.png?fit=max\&auto=format\&n=1Fb-SAr-OHTiP1JA\&q=85\&s=77d92748956d723626b9e26490402fad)

1. 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-integrate` starts on `default-otel`, which reads only the OpenTelemetry GenAI keys. To switch, click **Change template**, pick `default-agent` and click **Apply template**. Applying a template discards your path edits.
2. 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.
3. 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)
4. 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:

| **Field** | **Keys `default-agent` reads** |
| - | - |
| **Client: User Id** | Framework keys such as `langfuse.user.id` and `ai.telemetry.metadata.userId` first, then `enduser.id` and `user.id` |
| **Client: Session Id** | Framework keys such as `langsmith.trace.session_id` and `langfuse.session.id` first, then `session.id` and `gen_ai.conversation.id` |
| **LLM: Model** | `gen_ai.response.model` and `gen_ai.request.model` first, then framework keys such as `ai.model.id` and `llm.model_name` |
| **LLM: Input Tokens**, **LLM: Output Tokens** | `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens` first, then framework keys such as `llm.token_count.prompt` |
| **Client: Version**, **Client: Environment** | The resource attributes `service.version` and `deployment.environment`, after `langfuse.release` and `langfuse.environment` |

**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 `Waiting for first event to arrive`.

![Pipeline page with the setup steps Config your project and Raw events received checked and First enrichment run pending, above the Streaming section of raw events, tagged Near real-time. Its cards read Latest event received at Nov 18, 2026, 1:05:07 AM UTC+1, Total events · 24H 1,016,981 and Events this hour 906,157, above a bar chart of the last 24 hours.](https://mintcdn.com/kubit/1Fb-SAr-OHTiP1JA/images/agent-analytics/pipeline.png?fit=max\&auto=format\&n=1Fb-SAr-OHTiP1JA\&q=85\&s=27a5e6428cc7eb027c075bb0135b0556)

Then look at the traces:

1. Open **Agent** > **Activity**.
2. 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.

   ![The Activity traces grid after Execute, with a Timeline of trace counts in 5-minute bars and errors in red, above a grid with the columns Timestamp, Name, Spans, Latency, Tokens, Cost, Time To First Token, Environment, Model and Labels. The footer reads 3,000 Traces, 1-50 shown.](https://mintcdn.com/kubit/1Fb-SAr-OHTiP1JA/images/agent-analytics/activity-traces.png?fit=max\&auto=format\&n=1Fb-SAr-OHTiP1JA\&q=85\&s=1cb27fc406fa9c2fb48791cf85f0332b)
3. 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.

   ![An open trace named Chat with an OK status. The header shows Latency 4.00s, Total cost \$0.0011, Tokens 1,930 to 32, a User ID and a Session ID. The Timeline lists the spans Chat, Classify Intent, a gemini-3-flash-preview LLM call, an invoke\_agent span and four execute\_tool spans. The Details panel's Preview tab shows the Input message, the Output agent and message, and Custom Fields such as Client: Browser and Client: City.](https://mintcdn.com/kubit/1Fb-SAr-OHTiP1JA/images/agent-analytics/activity-trace.png?fit=max\&auto=format\&n=1Fb-SAr-OHTiP1JA\&q=85\&s=f6ba1823dc46c907d3da2f3a566579aa)

## 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](#check-the-extraction-mapping).

## If it fails

| **Symptom** | **Cause** | **Fix** |
| - | - | - |
| Activity shows `No traces found` | The time range is too short, or no span has arrived | Set **Time Range** to **Last 7 days**, then check **Data** > **Pipeline** |
| **Data** > **Pipeline** shows `Waiting for first event to arrive` | No span reached Kubit | Work through [Is my data flowing?](https://learn.kubit.ai/agent-analytics/get-started/data-flowing.md) |
| **Data** has no **Pipeline** or **Extraction** | The workspace isn't an Agent workspace | Create a workspace with **Origin** set to **Agent** |
| A trace shows up, but a field is empty | The template reads a different key | Switch the template to `default-agent`, or edit the column's **Source paths** |

## Next Steps

* [Concepts](https://learn.kubit.ai/agent-analytics/concepts.md): users, sessions, traces, spans and what Polaris labels.
* [Is my data flowing?](https://learn.kubit.ai/agent-analytics/get-started/data-flowing.md): step-by-step checks when spans don't arrive.
* [Agent plugin](https://learn.kubit.ai/agent-analytics/integrate/agent-plugin.md#other-kubit-skills): query traces and reports from Claude Code or Cursor.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.