Work/Momotaro
2026

Momotaro

A payment failure and mandate recovery agent, built for Razorpay's AI Buildathon. Nine Go services diagnose why a payment failed and run the one bounded, auditable fix that matches the cause, guaranteeing exactly-once financial actions under at-least-once delivery.

GogRPCKafkaPostgreSQLRedisKubernetes
Kafka · partitioned backbone · DLQ · exactly-once
Ingest
DLQ
Kafka · 12 partitions
Recovery engine
Ledger writer
Audit stream
Postgres
Redis
gRPC

The problem

Financial recovery actions cannot execute twice, and cannot silently vanish on a crash mid-batch. Kafka’s at-least-once delivery makes duplicate processing the default, not the exception, so the system needed exactly-once guarantees built on top, not assumed from the transport.

The approach

Insert-before-execute writes against a Postgres UNIQUE constraint. Single-transaction state and audit commits, so there’s never a window where one exists without the other. Contiguous-offset-prefix Kafka commits, so a crash never skips or replays past what was actually durable.

Diagnosing the failure, not just retrying it

Built for Razorpay’s AI Buildathon (Track 03, AI Revenue Recovery), Momotaro watches payments, mandates, checkouts and invoices as they fail, and works out why each one failed rather than firing a generic retry. Root-cause classification runs on rules first; an LLM is only consulted when the rule-based check isn’t confident enough, and a hard sample-rate ceiling caps how much traffic can ever reach it. Whatever the cause, the system runs the one bounded, auditable intervention that actually matches it.