Part of Harshil Desai's evidence-first tools for Indian finance: LoanLens · PaisaTrail · IPO Lab · RecoverX
RecoverX is a safety-first revenue recovery MVP built for the Razorpay AI Revenue Recovery track. It uses an LLM to interpret customer context, then routes that context through deterministic policy guardrails before any recovery action is selected.
Important: payment outcomes and recovered amounts in this repository are simulated for the MVP benchmark. RecoverX does not move real money.
Traditional recovery systems often retry failed payments without considering what the customer is saying. RecoverX adds customer context while keeping financial action deterministic and auditable.
Customer reply
↓
AI / safety-first intent interpretation
↓
Deterministic policy guardrails
↓
RETRY · PAYMENT LINK · REMINDER · FOLLOW-UP · ESCALATE · STOP
↓
Deterministic simulated outcome
↓
Audit trail
The LLM does not execute financial actions directly.
| Signal | Policy action |
|---|---|
| Dispute / already-paid claim | STOP |
| Fraud / unauthorized-use claim | ESCALATE |
| Retry limit reached | STOP |
| High-value transaction | ESCALATE |
| Promise to pay later | FOLLOW-UP |
| Temporary network error | RETRY |
| Expired card | PAYMENT LINK |
The bundled synthetic dataset contains 47 transactions with ₹6,52,305 total value at risk.
A representative controlled run produced:
| Metric | AI-assisted | Rules-only |
|---|---|---|
| Recovered | ₹1,16,363 | ₹1,16,363 |
| Automated recovery attempted | ₹2,38,316 | ₹2,72,267 |
| Attempt success rate | 48.8% | 42.7% |
| Follow-up value | ₹59,558 | ₹0 |
The benchmark therefore demonstrates recovery parity with lower automated exposure and better successful-attempt efficiency, rather than claiming unsupported additional recovered revenue.
- Customer-context intent classification with persistent caching for reproducible demos.
- Deterministic policy engine that keeps hard financial guardrails authoritative.
- Deterministic paired outcome simulation so the same transaction gets the same underlying outcome score across AI and rules runs.
- Recovery queue for promise-to-pay cases.
- Transaction-level decision explanation and audit trail.
- CSV audit export.
- Automated safety tests.
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txtCreate .env in the project root:
GROQ_API_KEY=your_api_key_here
Then:
python app.py # debug off by default
$env:FLASK_DEBUG=1; python app.py # opt-in debug for local demosOpen http://127.0.0.1:5000.
python -m unittest discover -s tests -vThe safety suite (run on every push via GitHub Actions) covers dispute hard-stop, fraud escalation, promise-to-pay follow-up, retry limits, guardrail precedence over AI intent, aged-receivable escalation, follow-up accounting, and deterministic simulation.
- Run with AI ON.
- Show the impact panel and follow-up queue.
- Open a promise-to-pay case and show intent → policy → follow-up.
- Open a dispute case and show the hard STOP guardrail.
- Toggle AI OFF and compare the same batch.
- Export the audit trail.
- Python 3.11+
- Flask
- Groq API (
openai/gpt-oss-20b) - Vanilla JavaScript + Chart.js
- CSV / JSON / JSONL audit data
- Keep
.envout of Git. - Runtime cache and audit-history files are ignored by Git.
- Use a production WSGI server and disable Flask debug mode outside local demos.
MIT

