Basic LiveKit Voice Agent
Learn how to trace LiveKit voice agents with Noveum Trace
This guide shows you how to trace a LiveKit voice agent using Noveum Trace. You'll learn how to wrap STT/TTS providers and monitor voice interactions.
đŻ Use Case
Drive-Thru Voice Agent: A voice-powered ordering agent that takes customer orders, uses tools to process items, and responds naturally through speech.
đ Complete Working Example
đ Prerequisites
Set your environment variables:
đ§ How It Works
1. STT Wrapper
Wraps your speech-to-text provider to trace:
- Audio transcriptions: Full text of what was spoken
- Audio input duration and format
- Processing latency and performance
- Confidence scores and accuracy metrics
- Provider details (model, language, etc.)
2. TTS Wrapper
Wraps your text-to-speech provider to trace:
- Text-to-speech input: Exact text sent for audio generation
- Generated audio metadata: Duration, format, and quality details
- Audio generation time and latency
- Voice and model configuration
- Provider details and parameters
3. Session Tracing
setup_livekit_tracing() automatically traces:
- Agent lifecycle events
- User speech inputs
- Agent responses
- Tool executions
4. Context Enrichment
extract_job_context() enriches traces with LiveKit session metadata:
- Job Information: Job ID, agent name, and dispatch information
- Room Details: Room name, SID, and metadata
- Participant Info: Participant identity and connection details
- Session Context: Timestamps, permissions, and custom metadata
What gets added to your traces:
Benefits:
- Better filtering: Search traces by room, participant, or job ID
- Context awareness: Understand which user session each trace belongs to
- Debugging: Quickly identify issues for specific rooms or participants
- Analytics: Aggregate metrics by room, user, or agent
đ What You'll See in the Dashboard
After running the agent, check your Noveum dashboard:
Trace View
- Complete conversation flow
- STT transcriptions with original audio recordings
- Agent LLM calls
- Tool executions
- TTS generations with synthesized audio
Span Details
- Audio recordings: Play back actual STT input audio and TTS output audio
- Full transcription text and synthesis text
- Audio processing times and latency
- Transcription accuracy and confidence scores
- Response timing and quality metrics
- Tool call details
Metrics
- Session duration
- Turn-by-turn timing
- Audio quality metrics
- Cost tracking per operation
đ Troubleshooting
No audio traces?
- Verify STT/TTS wrappers are applied
- Check that
setup_livekit_tracing()is called - Ensure session is started with wrapped providers
Missing tool executions?
- Verify tools are defined with
@function_tool - Check that agent has tools in its configuration
- Ensure LLM has access to tool definitions
đĄ Pro Tips
- Use session IDs: Tie traces to user sessions for better context
- Monitor latency: Track STT/TTS processing times for optimization
- Extract job context: Always use
extract_job_context()to enrich traces with room and participant metadata - Add custom metadata: Include user context and business-specific data in trace attributes
đ Next Steps
- Explore LangChain integration for chaining
- Learn about LangGraph agents for complex workflows
Get Early Access to Noveum.ai Platform
Be the first one to get notified when we open Noveum Platform to more users. All users get access to Observability suite for free, early users get free eval jobs and premium support for the first year.