Skip to main content
LiveKit Agents is an open-source framework for building real-time voice and multimodal AI agents. It includes built-in OpenTelemetry tracing: pass LiveKit a tracer provider and it emits spans for agent sessions, turns, speaking activity, and model calls. Point that tracer provider at Phoenix to see every session in one place.
This page uses LiveKit’s native OpenTelemetry pipeline. It doesn’t need a LiveKit-specific OpenInference instrumentor.

Install

Setup

Set your Phoenix endpoint as an environment variable, along with your LiveKit server credentials:
Create a Phoenix tracer provider and hand it to LiveKit before the session starts. LiveKit can also attach metadata to every span, which is useful for stable session or room attributes:
instrumentation.py

Run LiveKit Agents

Configure tracing before the agent session starts, then flush spans when the job shuts down:
This example shows how to add Phoenix tracing to an existing LiveKit Agents app. Configure AgentSession with the STT, LLM, and TTS plugins your app uses, and launch the worker as described in the LiveKit quickstart.
agent.py
Setting session.id in the metadata groups each room’s spans into a Phoenix session.

Observe

Run an agent session and open the livekit-agents project in Phoenix. Depending on your LiveKit version and plugins, the trace includes:
  • Agent session and turn spans
  • User and agent speaking spans
  • Lifecycle spans for agent activity
  • Model and realtime-model spans, with metrics
  • Any custom metadata you attach through set_tracer_provider
LiveKit spans are native OpenTelemetry spans. To also capture rich prompt, response, token, and tool detail for the LLM SDK your agent calls, add the matching OpenInference instrumentor and pass it the same tracer_provider.

Troubleshooting

  • No spans in Phoenix. Confirm configure_livekit_tracing() runs before AgentSession.start(...), and that force_flush() runs before the worker exits.
  • Spans land in the wrong project. Set project_name in register(), or set PHOENIX_PROJECT_NAME in the worker’s environment.

Resources