Failed UPI Autopay and card mandate debits represent significant lost recurring revenue for subscription and lending businesses in India, but NPCI's retry regulations are strict and unforgiving — a single attempt plus three retries, with peak-hour restrictions, and no tolerance for over-retrying. Most recovery automation either retries too aggressively (risking regulatory violations and merchant penalties) or too conservatively (leaving recoverable revenue on the table), and prompt-based 'guardrails' on LLM agents are trivially bypassable, making agentic automation of money-moving retries a compliance liability rather than an asset.
Winback wraps an LLM agent (Claude Agent SDK) with a can_use_tool callback that sits below the model, not inside its prompt — physically intercepting every tool call and rejecting any retry that would violate NPCI's attempt/retry ceiling or fall inside a restricted peak-hour window, regardless of what the model decides to do. Every decision, blocked or allowed, is written to an append-only, Postgres-trigger-enforced audit trail. Revenue impact was validated against a naive always-retry baseline using a 4-arm counterfactual bootstrap evaluation across 10,000 resamples, showing Winback matches naive-retry recovery while cutting compliance violations from 66 to zero. A 612-test suite (99% coverage on the compliance module) and a cold-clone verification pass — which caught and fixed a real latent defect before submission — back the Razorpay AI Buildathon 2026 entry.
Claude Agent SDK agent loop → can_use_tool callback intercepts every tool invocation before execution, checking NPCI retry state (attempt count, retry count, time-of-day) against a hard rule set before allowing or rejecting the call → Razorpay MCP server exposes payment-retry tools to the agent → FastAPI backend + PostgreSQL persist retry state and an append-only audit trail enforced by database triggers → React dashboard surfaces recovery outcomes and compliance status. Evaluation harness: 4-arm counterfactual bootstrap (10,000 resamples) comparing Winback against a naive always-retry baseline on revenue recovered and violations committed. Verification: 612 pytest tests (99% coverage on the compliance module), plus a cold GitHub clone re-run that surfaced and fixed one real latent defect ahead of the Razorpay AI Buildathon 2026 submission.
Compliance is enforced by a can_use_tool callback that intercepts every tool call the agent attempts, beneath the model rather than inside its prompt — physically blocking unauthorized money-moving actions instead of merely instructing the model not to take them.
Encodes India's NPCI retry regulations for UPI Autopay and card mandate debits directly into the guardrail: one initial attempt plus three retries, with peak-hour windows restricted, enforced deterministically regardless of agent behaviour.
10,000-resample bootstrap comparing Winback against a naive always-retry baseline shows matched revenue recovery with zero compliance violations, versus 66 violations committed by the naive strategy.
Every agent decision — allowed or blocked — is written to an append-only audit log enforced at the database level via Postgres triggers, giving a tamper-evident record of every retry attempt.
612 passing tests with 99% line coverage on the compliance module, plus a cold GitHub clone re-run that surfaced and fixed a real latent defect before the Razorpay AI Buildathon 2026 submission.