LiveKit Integration Quick Start
Get up and running with NextEVI and LiveKit Agents to create a real-time voice AI that works seamlessly with LiveKit’s playground and ecosystem.Overview
This guide shows you how to create a NextEVI agent that:- Integrates with LiveKit’s AgentSession for proper transcription display
- Handles real-time audio streaming
- Works with LiveKit playground for easy testing
- Bridges NextEVI’s transcriptions to the LiveKit interface
Complete Example
Create a file calledmain.py:
Environment Setup
Make sure your environment variables are configured:Running the Agent
Start your NextEVI agent:Testing with LiveKit Playground
- Open LiveKit Playground
- Connect to your LiveKit instance
- Join a room where your agent is running
- Start speaking - you’ll see:
- Real-time transcriptions in the chat interface
- NextEVI’s empathetic voice responses
- Emotion detection and natural conversation flow
How It Works
AgentSession Integration
- Custom STT Component: Bridges NextEVI’s transcriptions to LiveKit’s interface
- Transcription Display: Shows real-time speech recognition in the playground chat
- Seamless Integration: Works with existing LiveKit tools and workflows
Audio Flow
- Input: User speaks → LiveKit captures audio → Sent to NextEVI
- Processing: NextEVI handles STT, emotion detection, LLM, and TTS
- Output: NextEVI audio → Streamed back to LiveKit → User hears response
- Transcription: NextEVI transcriptions → Custom STT → Playground interface
Key Features
Real-time Transcription
See live transcriptions in LiveKit playground interface
Emotion Recognition
NextEVI’s built-in emotion detection and empathetic responses
Full-duplex Audio
Natural conversation with interruption handling
Easy Testing
Works seamlessly with LiveKit playground for development
Next Steps
- Production Deployment: Scale your agent using LiveKit Cloud
- Custom Configurations: Modify NextEVI settings for your use case
- Advanced Features: Explore emotion detection and turn detection
- Authentication: Set up secure authentication for production
Troubleshooting
No Transcriptions Showing
No Transcriptions Showing
Ensure the
on_transcription callback is properly set and the NextEVISTT component is receiving transcriptions. Check the agent logs for STT bridge messages.Audio Not Working
Audio Not Working
Verify that the audio source is properly configured and the LiveKit room has audio permissions. Check that the sample rate matches (48kHz).
Environment Variable Issues
Environment Variable Issues
Double-check all environment variables are set:
