SentinelPay Pairs Idempotent Payment Ledger With Guardrailed AI Dispute Agent

The author describes SentinelPay, a fault-tolerant double-entry ledger paired with a stateful AI dispute resolver. The system is built around three invariants: money is never created, lost, or double-charged; transfers run in single PostgreSQL ACID transactions with deterministic row locks and two-layer idempotency keys; and an AI model never directly decides refunds. The LLM only produces a structured risk score, while a unit-tested pure Python function makes the final credit-or-escalate decision and the reasoning trace is stored in JSONB. The architecture splits work across an API gateway, a ledger service, a LangGraph agent worker, and a Next.js console, with Redis handling rate limiting and event streaming. The write-up also explains how the design prevents deadlocks and double-spending under concurrent transfers.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in