01Autonomous LLM agent pipeline
AI Revenue Recovery Engine
An autonomous pipeline that wins back revenue lost to failed payments, abandoned checkouts and declined subscriptions, with safety guardrails on every action.
40%
of failed payments recovered
₹3.13L
net value recovered in a 150-case batch
100%
guardrail precision on fraud and disqualified cases
4.8s
average time to resolve a case
Overview
0x
return on every ₹1 spent
Payment gateways fail for many reasons: timeouts, expired cards, low balances, authentication friction, even vague support tickets. Manual dunning and blind retries leak revenue, annoy customers and risk fraud. This engine handles every case through a deterministic 5-stage loop that classifies the cause, picks a bounded action, executes it, and writes an append-only audit trail.
(01)Features
What it does
Hybrid diagnosis
Known gateway error codes are mapped instantly and deterministically. Ambiguous cases, including Hinglish support notes, fall back to a Groq and Gemini Flash cascade that classifies into a strictly bounded set of causes.
Policy-bounded actions
Twelve registered policy rules decide which interventions are allowed: alternative payment rail, payment link, cooldown retry or human escalation. The model never invents an action.
Safety invariants
At most three interventions per customer per day, a 48-hour cooldown on soft declines, and a global kill switch that halts everything instantly.
Full auditability
Every case produces an unbroken lifecycle trace in the ledger, verified at the end of each run, with gross recovery, channel cost and net yield tracked per case.
(02)Architecture
The five-stage pipeline
- 1
Detector
Filters out fraud, duplicates and chargebacks before any customer is contacted.
- 2
Diagnoser
Finds the root cause with deterministic rules first and an LLM fallback second, with a confidence score.
- 3
Strategist
Selects a bounded action plan from the policy registry and checks it against the safety guardrails.
- 4
Executor
Runs the plan through the Razorpay API and WhatsApp, email, SMS or support escalation channels, idempotently.
- 5
Auditor
Reconciles outcomes, computes cost-aware ROI and verifies the audit trail end to end.
(03)Tech stack
Built with
Backend
- Python
- FastAPI
- SQLAlchemy (async)
- Alembic
- Pydantic v2
- Pytest
AI
- Groq
- Gemini Flash
Frontend
- React 19
- TypeScript
- Vite
- Tailwind CSS
Infrastructure
- Docker
- Nginx
- PostgreSQL
Next project