Reclaim
Autonomous AI Revenue Recovery Agent

Project Overview
Reclaim is an autonomous, policy-guarded AI revenue recovery agent engineered for Track 03 (AI Revenue Recovery) of the Razorpay AI Buildathon 2026. Indian digital merchants bleed over ₹15,000 Crores every year to payment degradation, checkout abandonment, and overdue B2B receivables. Conventional recovery workflows rely on generic, uncoordinated SMS/email blasts that feel spammy, damage brand equity, and yield dismal conversion rates with zero policy guardrails. Reclaim replaces blunt retries with an intelligent, closed-loop agent that diagnoses root causes before acting, executes bounded interventions from a fixed catalog, enforces hard non-LLM-overridable stopping rules, and proves measured rupee recovery with an immutable audit trail compliant with India's DPDP Act 2023.
Three Dedicated Recovery Lanes
To maximize recovery yield across the merchant lifecycle, Reclaim structures interventions into three distinct lanes: • **Lane A — Payment Degradation:** Intercepts payment and subscription mandate failures. Classifies failures (insufficient funds, bank gateway timeout, 3DS OTP drop-off, card expired) and dispatches instant UPI Intent links or smart payment method switch nudges. • **Lane B — Magic Checkout Abandonment:** Identifies high-intent drop-offs and initiates rate-limited nudges (maximum 3 touches over 72h) with policy-capped incentives. • **Lane C — B2B Receivables Chaser:** Executes a disciplined escalation ladder for overdue invoices (friendly reminder → firm notice → payment plan offer) and tracks "promise to pay" commitments.
Two-Tier Zero-Hallucination AI Architecture
Financial operations require absolute mathematical and legal precision. Reclaim guarantees safety through a strict two-tier architecture: • **Tier 1 (Deterministic Policy Engine - 0ms):** Evaluates hard constraints before any action is authorized: allowed contact hours (9:00 AM – 7:00 PM IST), 4-hour cooldown windows, 3-attempt lifetime caps, discount ceilings, and opt-out suppression. The LLM has zero authority to bypass these checks or alter monetary values. • **Tier 2 (Gemini 2.0 Flash LLM):** Used exclusively for context-aware tone calibration (drafting empathetic copy in English and Hinglish) and resolving ambiguous transaction descriptions via structured JSON schemas (`responseSchema`).
Relational Data Architecture & Immutable Audit Log
Powered by PostgreSQL and Prisma ORM, Reclaim models relational links across merchants, customers, invoices, payment attempts, recovery cases, and actions. Every decision, policy pass, stop event, and outcome is recorded into an append-only `audit_log` table with write-once permissions at the DB role level, providing an inspectable cryptographic trail for regulatory compliance.
Interactive Webhook Simulator & AI Voice Agent
Reclaim features an end-to-end sandbox simulator. Evaluators can trigger HMAC-SHA256 signed Razorpay webhooks (`payment.failed`, `order.paid`), inspect customer phone mocks, test bilingual voice recovery calls powered by Web Speech synthesis, and monitor real-time recovery metrics in an interactive financial command center.
Engineering Challenges & Solutions
Challenge
Eliminating LLM Hallucinations in Financial Operations: Generative LLMs unpredictably hallucinated discount amounts (e.g. granting unauthorized 50% waivers) and bypassed commercial rules.
Solution
Architected a strict Two-Tier Separation of Concerns. Gemini 2.0 Flash is confined strictly via structured responseSchema to tone-adapted copywriting. All monetary logic, fee calculations, and channel dispatch authorizations are hardcoded in a deterministic Policy Engine with 0ms LLM authority.
Challenge
Webhook Race Conditions & Idempotency Defense: Razorpay's concurrent webhook retries (payment.failed) caused database race conditions, resulting in duplicate recovery cases and repeated customer outreach.
Solution
Enforced HMAC-SHA256 signature verification (X-Razorpay-Signature) at the API boundary, paired with composite unique database constraints on (merchantId, razorpayPaymentId) and transactional upserts to guarantee strict idempotency.
Challenge
Cloud Server UTC vs IST Timezone Drift in DPDP Compliance: Node.js servers hosted in cloud environments run on UTC. Naive Date.getHours() checks evaluated 10:00 AM IST as 04:30 UTC, causing outreach to either be erroneously blocked or sent during customer quiet hours (violating DPDP Act guidelines).
Solution
Built timezone-aware temporal evaluation using Intl.DateTimeFormat pinned to IANA Asia/Kolkata. Enforced strict 9:00 AM – 7:00 PM IST contact boundaries, a mandatory 4-hour cooldown between touches, and a 3-attempt lifetime cap with one-click opt-out.
Challenge
LLM API Latency & 429 Outage Resilience: Network latency or 429 rate limits from Gemini API during peak batch recovery runs could block time-sensitive 3DS OTP drop-off recovery.
Solution
Engineered an automated offline heuristic fallback with exponential backoff. If the LLM API times out (>3000ms) or encounters rate limits, the system seamlessly degrades to pre-compiled, contextual static templates without halting the recovery pipeline.
Technologies Used
Key Metrics & Results
- 77.3% measured net recovery rate (₹1,42,800 salvaged out of ₹1,84,650 at risk).
- Synthetic benchmark scorecard: 92.3% Precision and 96.4% Correct Hold Rate across 55 test cases.
- 122 automated tests: 93 passing Vitest backend tests, 29 frontend tests, and 0 a11y violations.
- Append-only cryptographic audit logs compliant with Digital Personal Data Protection (DPDP) Act 2023.
- 5-minute pitch video & live interactive demonstration covering webhook simulation to resolution.