Skip to main content
Razorpay AI Buildathon 2026 · Autonomous Recovery Infrastructure

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.

01Blind Cadence
Timer-Driven

The Broadcast Black Hole

Legacy systems fire automated emails every 3 days. They cannot parse reply intent or verify settlement claims.

Day 01 · Automated NoticeSent
Debtor: “Checking invoice with accounts...”
Day 04: Bot sends generic reminder anyway (Reply ignored)
Result:Spam flag · Zero attribution
02Context Loss
No State Store

Commitment Amnesia

Debtors promise to pay on a specific date. Without an active commitment ledger, legacy bots keep nagging beforehand.

INBOUND PROMISEJan 03

“We will process ₹42,000 on Jan 10 via NEFT.”

LEGACY BOT (Jan 05)Premature

“⚠️ URGENT: Your payment is 5 days overdue!”

Result:Customer goodwill destroyed
03Dispute Void
Binary Rules

False-Escalation Waves

Legitimate line-item disputes get escalated straight to collections handoffs because simple rules can't freeze a case.

LINE-ITEM DISPUTE

“Quantity mismatch on Item #3. Please revise invoice.”

LEGACY HANDOFFWrongful Action

Account flagged for external legal collections

Result:Merchant churn & legal cost

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

LLM: PARSE ONLYPOLICY ENGINE: CONTROLS ACTION
01 · Ingest & Queue

Invoice / Receivable

Next.js API route claims jobs via SELECT FOR UPDATE SKIP LOCKED queue table.

Table: recovery_cases
02 · Understanding

LLM Reply Parser

Extracts structured promises, amounts, and dates into strict Zod schemas. Zero DB write permissions.

Boundary: Read/Parse Only
03 · Authority Gate

Policy Engine + State Machine

Sole write path (`StateTransitionService`). Enforces 90d horizons, 3/7d caps, and Dispute Freeze.

Authority: Atomic Row Lock
04 · Payment Verification
TEST MODE

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.

Outcome: CLOSED_PAID + AuditNo real money charged

INTERACTIVE RECOVERY PATHS

Explore how the agent executes in real scenarios

STAGE 03 EVIDENCE

Reply Understanding · Structured Intent Parsed

Actor: Gemini LLM ParserAWAITING_REPLY (Parsing)

Debtor replies with concrete commitment date. Model parses payload into strict Zod schema with ZERO write permission.

Debtor Natural Language ReplyLLM: PARSE ONLY (Zero DB write access)
"Hi, our finance director has approved this payment. We will process ₹42,000 on Jan 10 via NEFT transfer. Thanks, Olive Trading."
Zod-Validated JSON Schema OutputACID Lock Verified
{
  "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. */
Classifications below 70% confidence route to clarification promptTable: debtor_replies
Dual Timestamps ✓Zero DB Writes by LLM ✓

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
READ / PARSE ONLY
  • 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.
LLM In-Memory Schema Output (Zero DB Access)0 DB Tools
{
  "intent": "PROMISE_CANDIDATE",
  "promised_amount": 42000.00,
  "promised_date": "2026-01-10",
  "confidence": 0.96,
  "has_dispute": false
}
PERMITTED: Structured JSON OutputZero DB writes

Authority Layer (Policy Engine)

Deterministic StateTransitionService
SOLE WRITE AUTHORITY
  • Sole State-Transition Authority — Only StateTransitionService writes 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.
State-Transition Service (Atomic Begin)Row Lock
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;
SOLE WRITE AUTHORITY: ACID SerializedAtomic Postgres Lock
Zero Unchecked DB Mutations
In-Memory Zod Schema Validation
ACID Row-Level Locking
Dual Timestamps Audit Trail

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.

TEMPORAL GATE
21:00–09:00 IST

Quiet Hours Block

QUIET_HOURS_START_IST = 21

Zero outbound debtor messages dispatched during evening and night hours. Outreach automatically queues in memory until the 09:00 IST window opens.

Deterministic CheckStrict Invariant ✓
FREQUENCY CEILING
3 touches / 7 days

Anti-Harassment Ceiling

MAX_TOUCHES_PER_WINDOW = 3

Hard ceiling on communication touches per rolling 7-day window. Eliminates repetitive dunning and preserves debtor trust and brand goodwill.

Rolling 7-Day WindowZero Spam Rule ✓
CREDIT POLICY
90 Days Max

Max Promise Horizon

MAX_PROMISE_HORIZON_DAYS = 90

Promises extending beyond 90 calendar days are rejected by deterministic policy and routed directly to merchant console reviewers for human credit authorization.

Calculated from Due DateCredit Guard ✓
RECONCILIATION
≥ 90% Settles Full

Partial Payment Tolerance

PARTIAL_PAYMENT_TOLERANCE_PCT = 90

Settlements meeting 90% threshold transition to CLOSED_PARTIAL (KEPT) without triggering erroneous broken-promise escalations.

Webhook ReconciledZero False Break ✓
LADDER CADENCE
+3d → +7d → Day 14

Cadence Ladder & Timeout

GHOSTED_TIMEOUT_DAYS = 14

Progression from Reminder 2 (+3d) to Reminder 3 (+7d) to Collections Handoff if debtor remains completely unresponsive after 14 calendar days.

Predictable LadderAutomated Stop ✓
DISPUTE PRESERVATION
Frozen, Not Cancelled

Dispute-Freeze Invariant

is_frozen = TRUE

Disputed commitments enter frozen hold state (is_frozen = true), preserving original dates until human dispute determination in merchant console.

Key DifferentiatorNever Voided ✓

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.

recoup.internal/app/cases/39fff352...
SIMULATED REPLAYDISPUTE_OPENINV-2101 · ₹42,000
SYSTEM·case_opened

Case opened for INV-2101 (Olive Trading) — ₹42,000 overdue

Jan 1, 2026 · 11:19 AM

Real: 2026-08-25 UTC

SYSTEM·debtor_reply_received

“We will process payment of ₹42,000 by Jan 10.”

Jan 3, 2026 · 11:19 AM

Real: 2026-08-25 UTC

LLM PARSER·reply_parsed (PROMISE_CANDIDATE)

Structured extraction: ₹42,000 due 2026-01-10 (Confidence: 95.2%)

Jan 3, 2026 · 11:20 AM

Real: 2026-08-25 UTC

POLICY ENGINE·commitment_validated

Promise registered for ₹42,000 → State advanced to COMMITMENT_ACTIVE

Jan 3, 2026 · 11:21 AM

Real: 2026-08-25 UTC

POLICY ENGINE·dispute_detected_commitment_frozen

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

Dual timestamps enforce non-repudiation across simulated clock and physical UTC time.View live in console

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

N = 200 Simulated Invoices
Recovered Debt (Extinguished)₹50,05,977 (40.12%)
Outstanding Active & Escalated Balance₹74,71,173 (59.88%)
Clean Promise Honor: 100% (60/60)Dispute Human Review Queue: 20% (40/200)LLM Schema Validity: 100% (180/180)
Razorpay AI Buildathon 2026

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.