Collection Agent using LiveKit
Overview
This guide demonstrates how to build a voice-based collection agent that can handle payment reminders, follow-ups, and payment assistance using LiveKit for real-time communication and Sarvam AI for speech processing. Perfect for fintech companies, banks, and lending institutions serving Indian customers.
What You’ll Build
A collection agent that can:
- Make professional payment reminder calls in multiple Indian languages
- Handle customer queries about payments, due dates, and payment options
- Guide customers through payment processes
- Maintain a professional and empathetic tone
Quick Overview
- Get API keys (LiveKit, Sarvam, OpenAI)
- Install packages
- Create
.envfile with your API keys - Write the agent code
- Run:
python agent.py dev - Test:
python agent.py console
Quick Start
1. Prerequisites
- Python 3.9 or higher
- API keys from:
- LiveKit Cloud (free account)
- Sarvam AI (get API key from dashboard)
- OpenAI (create new secret key)
2. Install Dependencies
macOS/Linux
Windows
3. Create Environment File
Create a file named .env in your project folder and add your API keys:
Replace the values with your actual API keys.
4. Write Your Agent
Create collection_agent.py:
5. Run Your Agent
6. Test Your Agent
In a new terminal, run:
Customization Examples
Example 1: Hindi Collection Agent
For customers who prefer Hindi:
Example 2: Tamil Collection Agent
Example 3: Multilingual Agent (Auto-detect)
Available Options
Language Codes
Speaker Voices (Bulbul v2)
Female Voices:
anushka- Clear and professional (default)manisha- Warm and friendlyvidya- Articulate and precisearya- Young and energetic
Male Voices:
abhilash- Deep and authoritative (recommended for collection)karun- Natural and conversationalhitesh- Professional and engaging
Pro Tips
- Use
language="unknown"to automatically detect the language - great for diverse customer bases - Use a professional male voice like
abhilashorkarunfor collection calls - Sarvam’s models handle code-mixing naturally - customers can switch between languages mid-conversation
- Always maintain compliance with collection regulations in your jurisdiction
Troubleshooting
API key errors: Check that all keys are in your .env file and the file is in the same directory as your script.
Module not found: Run the installation command again based on your operating system.
Poor transcription: Try language="unknown" for auto-detection, or specify the correct language code.
Additional Resources
Need Help?
- Sarvam Support: developer@sarvam.ai
- Community: Join the Discord Community
Happy Building!