Before you start
- Python 3.9 or later
- A Kubit workspace and its ingestion API key (see below)
- An agent that calls an LLM, or any Python script to test with
Prompt for your coding agent
Paste this into Claude Code, Cursor or Codex in your repo: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.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. Atlas 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 The two-second sleep gives the exporter time to send the span before the process exits.
kubit_instrumentation.py, run: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
Verify
Check that thehello-kubit span arrived. With the Kubit MCP server connected in Claude Code or Cursor, ask:
“Show me traces from the last 15 minutes”The result lists a trace whose root span is named
hello-kubit, from service support-agent.
In the Kubit app:
If it fails
More checks are in Is my data flowing?.
Next steps
- Send traces from Python: existing providers, frameworks and production settings.
- Span attributes: add user and session IDs so Atlas can group traces.
- Concepts: what Polaris does with the spans you just sent.