Documentation Index
Fetch the complete documentation index at: https://docs.tracectrl.ai/llms.txt
Use this file to discover all available pages before exploring further.
Programmatic Configuration
Callconfigure() before calling any instrumentor’s .instrument() method.
Parameters
The OTel Collector gRPC endpoint. Defaults to
http://localhost:4317. Use http://otel-collector:4317 when your agent runs inside Docker. The SDK strips the scheme and routes via gRPC; https:// URLs switch the exporter to TLS, anything else uses insecure mode.The service name attached to all spans. Appears in the
service.name resource attribute. Defaults to tracectrl-agent.Optional API key for authenticated collectors. Sent as a
Bearer token in the Authorization header.When
true, exporter failures are logged as warnings instead of raising exceptions. Defaults to true — your agent never crashes because tracing fails.configure() accepts only the four kwargs above. Batch tuning (TRACECTRL_BATCH_DELAY_MS, TRACECTRL_MAX_BATCH_SIZE) is environment-only.Environment Variables
All configuration can also be set via environment variables. Programmatic values take precedence.| Variable | Default | Description |
|---|---|---|
TRACECTRL_ENDPOINT | http://localhost:4317 | OTel Collector gRPC endpoint |
TRACECTRL_SERVICE_NAME | tracectrl-agent | Service name for spans |
TRACECTRL_API_KEY | — | Bearer token for authenticated collectors |
TRACECTRL_BATCH_DELAY_MS | 1000 | Batch export delay in milliseconds |
TRACECTRL_MAX_BATCH_SIZE | 512 | Maximum spans per export batch |
TRACECTRL_FAIL_SILENTLY | true | Suppress exporter errors |
TRACECTRL_SESSION_ID | — | Override auto-generated session ID |
TRACECTRL_API_URL | http://localhost:8000 | Engine HTTP base — used to fetch Protector Plus config |
Platform Environment Variables
These are used by the TraceCtrl Engine and Docker stack, not the SDK:| Variable | Default | Description |
|---|---|---|
CLICKHOUSE_HOST | localhost | ClickHouse host (clickhouse in Docker) |
CLICKHOUSE_PORT | 9000 | ClickHouse native protocol port |
CLICKHOUSE_DB | tracectrl | ClickHouse database name |
PIPELINE_INTERVAL_SECONDS | 60 | Pipeline processing interval |
VITE_ENGINE_URL | http://localhost:8000 | Engine API URL (baked into UI at build) |
Tagging Agents
Most agent frameworks do not emit the system prompt on their OTEL spans. Calltag_agent once per agent so TraceCtrl can attribute spans to a named agent in the dashboard:
tag_agent is idempotent and installs a SystemPromptStamper SpanProcessor on the shared TracerProvider so that every subsequent agent-run span carries tracectrl.agent.system_prompt and a 16-character SHA-256 hash.
TracerProvider
The SDK lazily creates a sharedTracerProvider with:
- An OTLP gRPC exporter pointed at your endpoint
- A
BatchSpanProcessorfor async export (configurable batch size and delay) - The
SystemPromptStamperfor agent attribution
TracerProvider, you can skip configure() and pass it directly:

