Skip to content

techAsmita/CFLO-Agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CFLO AI Voice Agent

AI-powered outbound voice agent for debt collection and EMI recovery β€” built for CFLO, a fintech lending and collections platform.


What it does

The agent autonomously calls borrowers, identifies them by phone number, discusses overdue EMIs, handles hardship cases empathetically, and captures Promise-To-Pay (PTP) commitments β€” all without human intervention.


Architecture

Twilio (telephony) β†’ FastAPI (backend) β†’ Groq Llama 3.3 70B (LLM) β†’ TwiML (voice response)
                            ↕
                     SQLite (mock banking DB)
                     PTP log / Call log / Borrower profiles

Tech Stack

Layer Technology
Telephony Twilio Voice
Backend FastAPI + Uvicorn
LLM Brain Groq β€” Llama 3.3 70B
Speech Recognition Twilio built-in (Deepgram Nova-3 ready)
Text to Speech Twilio Polly Aditi (ElevenLabs ready)
Database SQLite (PostgreSQL ready for production)
Tunnel ngrok
Language Python 3.11

Features

  • Outbound calling β€” agent calls borrowers automatically from dashboard
  • Borrower identification β€” looks up caller by phone number in real time
  • Intelligent dialogue β€” context-aware conversations using Llama 3.3 70B
  • Tone calibration β€” empathetic for hardship cases, firm for chronic defaulters
  • PTP capture β€” automatically logs payment commitments with amount and date
  • Risk segmentation β€” S1 (critical) to S5 (self-cure) aligned with CFLO spec
  • Compliance guardrails β€” no threats, no PII leakage, RBI Fair Practice Code aligned
  • Management dashboard β€” view all borrowers, trigger calls, monitor PTPs
  • Human escalation β€” hands off to live agent when needed

Project Structure

cflo-voice-agent/
β”œβ”€β”€ main.py                    FastAPI app entry point
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ voice.py           Twilio webhook handlers (inbound + outbound)
β”‚   β”‚   β”œβ”€β”€ outbound.py        Trigger outbound calls
β”‚   β”‚   └── dashboard.py       Management dashboard UI
β”‚   └── services/
β”‚       └── dialogue.py        LLM brain β€” Groq + system prompt + PTP logic
β”œβ”€β”€ data/
β”‚   └── database.py            SQLite β€” borrowers, PTP log, call log
β”œβ”€β”€ .env                       API keys (not committed)
└── requirements.txt           Dependencies

Setup Instructions

1. Clone and install

git clone https://github.com/techAsmita/CFLO-Agent.git
cd CFLO-Agent
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

2. Create your .env file

TWILIO_ACCOUNT_SID=your_twilio_sid
TWILIO_AUTH_TOKEN=your_twilio_token
TWILIO_PHONE_NUMBER=your_twilio_number
GROQ_API_KEY=your_groq_key
BASE_URL=your_ngrok_url

3. Initialise the database

python data/database.py

4. Start the server

python main.py

5. Start ngrok tunnel

ngrok http 8000

6. Configure Twilio webhook

In Twilio Console, go to your phone number and set Voice Configuration webhook to:

https://your-ngrok-url/voice/inbound
HTTP Method: POST

7. Open the dashboard

http://localhost:8000/dashboard

Alignment with CFLO AI Specification

This prototype directly implements Section 4.4 (AI Voice Agent) of the CFLO AI-ML Architecture specification (v1.0, May 2026):

  • Inbound and outbound call handling
  • LLM core with intent classification and slot filling
  • Dialogue state management with fallback paths
  • PTP capture and logging
  • Risk segment awareness (S1 critical through S5 self-cure)
  • Hardship detection and empathetic tone switching
  • Human escalation triggers
  • Compliance guardrails aligned with RBI Fair Practice Code
  • Deepgram Nova-3 STT integration ready
  • ElevenLabs TTS integration ready
  • Multi-language Hindi and Indic support ready

API Endpoints

Method Endpoint Description
GET / Health check
GET /health Server status
GET /dashboard Management dashboard
POST /voice/inbound Twilio inbound call webhook
POST /voice/respond Conversation turn handler
POST /voice/outbound Outbound call webhook
POST /call/test Trigger a test call

πŸ‘©β€πŸ’» Built by

Asmita β€” @techAsmita
B.E. Computer Engineering | AI/ML Enthusiast
LinkedIn

About

πŸ€– AI-powered outbound voice agent for debt collection & EMI recovery β€” Twilio + FastAPI + Groq Llama 3.3 70B + SQLite. RBI-compliant, empathetic tone switching, PTP capture. Built for CFLO fintech spec.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages