Skip to Content
Launching the open-source gateway

LiveKit (tracing)

LiveKit Agents  emits structured spans for agent sessions, model calls, and tool execution. Use Respan’s LiveKit instrumentation to emit them through the Respan tracing pipeline.

Set up Respan

Create an account at platform.respan.ai  and grab an API key .

Paste this into your coding agent:

Help me set up Respan tracing with the LiveKit integration. Follow https://www.respan.ai/docs/integrations/livekit.md

Setup

Install packages

Terminal
pip install respan-ai respan-instrumentation-livekit livekit-agents

Set environment variables

Terminal
export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"

Initialize and run

Python
import os from livekit.agents import llm from respan import Respan, workflow from respan_instrumentation_livekit import LiveKitInstrumentor respan = Respan( api_key=os.environ["RESPAN_API_KEY"], app_name="livekit-tracing", instrumentations=[LiveKitInstrumentor()], ) @workflow(name="livekit_chat.workflow") async def run_chat(model: llm.LLM) -> str: chat_ctx = llm.ChatContext.empty() chat_ctx.add_message(role="user", content="Say hello in one sentence.") response = await model.chat(chat_ctx=chat_ctx).collect() return response.text respan.shutdown()

Pass livekitModule when your app imports @livekit/agents directly. This ensures the instrumentor patches the same LiveKit module instance your application uses.

View your trace

Open the Traces page  and look for agent sessions, agent turns, LLM nodes, function tools, user turns, handoffs, and TTS spans generated from LiveKit agent execution.

Captured data

DataDescription
Agent sessionsLiveKit AgentSession spans and lifecycle context.
Agent turnsUser and assistant turn activity.
LLM nodesModel input and generated content.
Function toolsTool names, arguments, outputs, and errors.
HandoffsAgent transfers represented through LiveKit tool events.
TTS spansText-to-speech spans emitted by LiveKit.