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.
For the broader architecture pattern this agent fits into, telephony ingress, escalation, latency targets, see the IVR & Contact Center use-case guide.
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)
- 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)
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 v3)
Male (23): Shubh (default), Aditya, Rahul, Rohan, Amit, Dev, Ratan, Varun, Manan, Sumit, Kabir, Aayan, Ashutosh, Advait, Anand, Tarun, Sunny, Mani, Gokul, Vijay, Mohit, Rehan, Soham
Female (14): Ritu, Priya, Neha, Pooja, Simran, Kavya, Ishita, Shreya, Roopa, Tanya, Shruti, Suhani, Kavitha, Rupali
Pro Tips
- Use
language="unknown"to automatically detect the language - great for diverse customer bases - Use a professional male voice like
adityaoranandfor 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
- Sarvam AI Documentation
- LiveKit Documentation
- LiveKit Sarvam LLM Plugin
- LiveKit Sarvam STT Plugin
- LiveKit Sarvam TTS Plugin
Need Help?
- Sarvam Support: developer@sarvam.ai
- Community: Join the Discord Community
Happy Building!