Choose a setup method
Start with one method for a call path. Combining SDK tracking with framework
OpenTelemetry on the same call can create duplicate interactions.
Recommended: Agnost AI skill
Recommended. Choose this path when you want your coding agent to inspect the
project, select a supported transport, make the smallest instrumentation change,
send a test event, and verify that it reached Agnost AI.
1. Configure the OTLP destination
Set these variables in the agent worker environment:2. Register one batch exporter
Call LiveKit’s tracer-provider hook beforeAgentSession.start().
FanoutSpanProcessor is required by the current OTel 2.x API so
LiveKit can attach its metadata processor (and its Cloud exporter, when enabled)
after provider construction.
3. Add standard conversation context
Pass metadata toset_tracer_provider; LiveKit copies it to every native span.
Use standard attributes rather than Agnost-specific names:
If
session.id is absent, Agnost falls back to LiveKit’s lk.job_id, then
lk.room_name. For user identity, explicit enduser.id or user.id is best;
the participant identity on a native user-turn span is a safe fallback.
What appears in Agnost AI
agent_turnspans become the ordered user/assistant conversation turns.function_toolspans become tool calls with native arguments, output, and error state.- LLM request spans retain model, token, and
gen_ai.*attributes. - STT, TTS, speaking, evaluator, session, job, and activity spans remain visible in the trace.
- Native
lk.*, standardgen_ai.*, and your custom attributes remain available on events.
Flush on shutdown
Batch export is asynchronous. Register a shutdown callback so the worker sends the final turns before it exits:Verify
Run one real LiveKit agent session, then open Users in Agnost AI. Confirm:- The user appears under the value sent in
enduser.id. - The conversation shows alternating user and assistant turns.
- The trace contains the LiveKit agent, LLM, tool, STT, and TTS spans used by the session.
- Tool details show their native input and output.
Troubleshooting
- Register the provider before
AgentSession.start(); earlier spans cannot be recovered. - Use the traces URL ending in
/v1/traceswith the HTTP/protobuf exporter. - Confirm
X-Agnost-Org-IDis present inOTEL_EXPORTER_OTLP_HEADERS. - Do not point a generic OTLP exporter at LiveKit’s private observability URL.
- Flush the provider when a short-lived worker or test exits.
References
- LiveKit: Export traces
- LiveKit Python OTel example
- LiveKit TypeScript OTel example
- LiveKit TypeScript
setTracerProviderreference
Next steps
- Conversations: review complete voice interactions.
- Events: inspect native LiveKit spans and attributes.
- Tool calls: analyze tool arguments, results, errors, and latency.