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.mdSetup
Install packages
pip install respan-ai respan-instrumentation-livekit livekit-agentsSet environment variables
export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"Initialize and run
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
| Data | Description |
|---|---|
| Agent sessions | LiveKit AgentSession spans and lifecycle context. |
| Agent turns | User and assistant turn activity. |
| LLM nodes | Model input and generated content. |
| Function tools | Tool names, arguments, outputs, and errors. |
| Handoffs | Agent transfers represented through LiveKit tool events. |
| TTS spans | Text-to-speech spans emitted by LiveKit. |