Every promise to pay,
tracked, verified, and provable.
An autonomous recovery agent for Razorpay merchants that replaces blind dunning emails with verified debtor commitments, deterministic dispute freezing, and immutable audit logs.
Live console includes interactive Razorpay Test Mode checkout & webhook verification
Recovery Rate
40.12%
₹50.06L in 200-case simulation
Dispute Accuracy
100.0%
Deterministic freeze rule
Model Permission
0 Tools
Zero DB write access
Ledger Type
Append-Only
Dual-timestamped audit
The Industry Blindspot
Reminders get sent. Promises get made.
Nobody tracks which ones get kept.
Legacy dunning tools operate on blind email cadences. When a debtor replies with a commitment date or flags a dispute, traditional automation fails silently.
The Broadcast Black Hole
Legacy systems fire automated emails every 3 days. They cannot parse reply intent or verify settlement claims.
Commitment Amnesia
Debtors promise to pay on a specific date. Without an active commitment ledger, legacy bots keep nagging beforehand.
“We will process ₹42,000 on Jan 10 via NEFT.”
“⚠️ URGENT: Your payment is 5 days overdue!”
False-Escalation Waves
Legitimate line-item disputes get escalated straight to collections handoffs because simple rules can't freeze a case.
“Quantity mismatch on Item #3. Please revise invoice.”
Account flagged for external legal collections
Our Architecture
From overdue invoice to verified recovery
A bounded recovery agent where the LLM interprets natural language, while deterministic policy controls every state transition.
SYSTEM ARCHITECTURE OVERVIEW
End-to-end execution flow: DETECT ➔ UNDERSTAND ➔ DECIDE ➔ ACT ➔ VERIFY ➔ ESCALATE
Invoice / Receivable
Next.js API route claims jobs via SELECT FOR UPDATE SKIP LOCKED queue table.
LLM Reply Parser
Extracts structured promises, amounts, and dates into strict Zod schemas. Zero DB write permissions.
Policy Engine + State Machine
Sole write path (`StateTransitionService`). Enforces 90d horizons, 3/7d caps, and Dispute Freeze.
Razorpay Test Mode Checkout
Outstanding cases can be paid through Razorpay Standard Checkout in Test Mode. Server webhooks verify HMAC-SHA256 signature and reconcile ledger to CLOSED_PAID.
INTERACTIVE RECOVERY PATHS
Explore how the agent executes in real scenarios
Reply Understanding · Structured Intent Parsed
Debtor replies with concrete commitment date. Model parses payload into strict Zod schema with ZERO write permission.
"Hi, our finance director has approved this payment. We will process ₹42,000 on Jan 10 via NEFT transfer. Thanks, Olive Trading."
{
"intent": "PROMISE_CANDIDATE",
"promised_amount": 42000.00,
"promised_date": "2026-01-10",
"confidence": 0.96,
"has_dispute": false,
"dispute_ground": null
}
/* GUARANTEE: In-memory structured output only. Zero database tools. */Architectural Safety
AI proposes. The Policy Engine decides.
We do not give LLMs database write access or tool execution powers. The model operates solely as a schema-constrained structured output parser.
Intelligence Layer (LLM)
Gemini 2.5 Flash Structured Parser- Classifies Inbound Intent — Detects promise candidates, dispute grounds, or ambiguity.
- Extracts Structured Payloads — Pulls payment amounts and dates into strict Zod schemas.
- Calculates Per-Call Confidence — Flags classifications < 70% confidence for clarification.
- Drafts Outreach Copy — Tailors professional follow-ups using merchant brand voice.
{
"intent": "PROMISE_CANDIDATE",
"promised_amount": 42000.00,
"promised_date": "2026-01-10",
"confidence": 0.96,
"has_dispute": false
}Authority Layer (Policy Engine)
Deterministic StateTransitionService- Sole State-Transition Authority — Only
StateTransitionServicewrites state columns. - Enforces Dispute-Freeze Rule — Freezes commitments (
is_frozen = true); never voids them. - Hardcoded 13 Business Constants — Enforces 21:00-09:00 IST Quiet Hours, 3/7d caps, and 90d horizons.
- Immutable Audit Recording — Appends every state delta with actor attribution and dual timestamps.
BEGIN TRANSACTION;
SELECT * FROM recovery_cases
WHERE id = '39fff352' FOR UPDATE;
INSERT INTO commitments (case_id, amount_cents, due_date, status)
VALUES ('39fff352', 4200000, '2026-01-10', 'ACTIVE');
UPDATE recovery_cases
SET state = 'COMMITMENT_ACTIVE'
WHERE id = '39fff352';
COMMIT;Hardcoded Policy Rules
13 Locked Constants in Policy Engine
Zero inline numbers. Every threshold governing communication, validation, and escalation is an auditable constant locked in domain/policy-engine/config.ts.
Quiet Hours Block
QUIET_HOURS_START_IST = 21Zero outbound debtor messages dispatched during evening and night hours. Outreach automatically queues in memory until the 09:00 IST window opens.
Anti-Harassment Ceiling
MAX_TOUCHES_PER_WINDOW = 3Hard ceiling on communication touches per rolling 7-day window. Eliminates repetitive dunning and preserves debtor trust and brand goodwill.
Max Promise Horizon
MAX_PROMISE_HORIZON_DAYS = 90Promises extending beyond 90 calendar days are rejected by deterministic policy and routed directly to merchant console reviewers for human credit authorization.
Partial Payment Tolerance
PARTIAL_PAYMENT_TOLERANCE_PCT = 90Settlements meeting 90% threshold transition to CLOSED_PARTIAL (KEPT) without triggering erroneous broken-promise escalations.
Cadence Ladder & Timeout
GHOSTED_TIMEOUT_DAYS = 14Progression from Reminder 2 (+3d) to Reminder 3 (+7d) to Collections Handoff if debtor remains completely unresponsive after 14 calendar days.
Dispute-Freeze Invariant
is_frozen = TRUEDisputed commitments enter frozen hold state (is_frozen = true), preserving original dates until human dispute determination in merchant console.
Live Product Proof
An immutable decision ledger for every case
The 7-step causal chain for Case INV-2101 (Olive Trading) showing inbound replies, LLM structured intent extractions, deterministic Policy Engine gating, and the Dispute-Freeze rule in action.
Case opened for INV-2101 (Olive Trading) — ₹42,000 overdue
Jan 1, 2026 · 11:19 AM
Real: 2026-08-25 UTC
“We will process payment of ₹42,000 by Jan 10.”
Jan 3, 2026 · 11:19 AM
Real: 2026-08-25 UTC
Structured extraction: ₹42,000 due 2026-01-10 (Confidence: 95.2%)
Jan 3, 2026 · 11:20 AM
Real: 2026-08-25 UTC
Promise registered for ₹42,000 → State advanced to COMMITMENT_ACTIVE
Jan 3, 2026 · 11:21 AM
Real: 2026-08-25 UTC
Active commitment FROZEN (preserved, not cancelled) per Dispute-Freeze rule. Case moved to DISPUTE_OPEN.
Jan 5, 2026 · 11:21 AM
Real: 2026-08-25 UTC
Measured Empirical Benchmark
Evaluated across 200 overdue enterprise invoices
Full-lifecycle simulation across 8 distinct debtor behavioral scenarios with deterministic Policy Engine enforcement and zero LLM write permissions.
Invoiced Book
₹1.25 Cr
₹1,24,77,150 across 200 cases
Capital Recovered
₹50.06 L
₹50,05,977 extinguished debt
Capital Recovery Rate
40.12%
80 of 200 cases settled (40.0%)
Freeze Adherence
100.0%
0 wrongful promise cancellations
Portfolio Capital Settlement Distribution
Direct aggregation from PostgreSQL invoices and commitments ledger
Built for how recovery already works
at Razorpay's scale.
Eliminate revenue leakage, protect debtor relationships, and prove mathematical policy adherence on every overdue invoice.