
What do you show a bank when the customer who disputed a charge never clicked anything?
How I built Recourse, a deterministic evidence system for disputed AI-agent transactions — for the Bharat Builds Tour, and the three real AWS/API failures it took to get there.
In February 2026, Razorpay and NPCI launched an agentic payments pilot on Claude — letting people order from Zomato, Swiggy, and Zepto by conversation, using UPI Reserve Pay. A user pre-authorises a spending cap for a merchant, and from then on, an agent can transact within it without a PIN prompt every time.
It's a genuinely good idea. It also breaks something quietly: when one of those transactions gets disputed, the evidence a merchant's ops team normally reaches for — a device fingerprint, a click trail, a browser session — doesn't exist. No human clicked anything. An agent did.
I built Recourse over the Bharat Builds Tour's First Commit hackathon to answer one question: what replaces that evidence when the buyer wasn't a person?
The chain instead of the click
Recourse replaces the missing click trail with three things: the mandate (what the user actually authorised — a cap, a merchant, a validity window), the agent's own action log (search, select, confirm, pay, each timestamped), and the fulfilment record. Six deterministic checks run against those three: is the amount within cap, does the merchant match, is the mandate still active, was the order actually fulfilled, is the timeline internally consistent, is there no suspicious near-duplicate order under the same mandate.
Three of those checks are Cedar policies, evaluated by Amazon Verified Permissions — not a hand-rolled if-statement pretending to be a policy engine, an actual AWS authorization service. I chose it specifically because Cedar's native language bindings don't have a clean Python story, and Python is where the rest of the system lives.
The part I'm actually proud of
If all six checks pass, a language model writes a short narrative explaining the recommendation. Here's the thing: that narrative gets checked before a human ever sees it. It's rejected if it mentions anything structurally impossible for an agent-initiated transaction — a device fingerprint, an IP address, a browser session, a human clicking anything — or if it cites a rupee figure that doesn't appear anywhere in the real, structured facts. One generation attempt, no retries. A failure means the dispute escalates to a human, full stop.
My first version of this grounding check didn't work this way. It asked a second model to judge whether the first model had hallucinated — which meant a probabilistic system was quietly deciding whether to trust another probabilistic system, exactly the failure mode the whole architecture exists to prevent. I caught it and rewrote it as plain deterministic code: pattern matching and numeric comparison against structured facts, nothing that touches a network or a model.
What actually broke, in order
I'd love to say the AWS side was smooth. It wasn't, and I think that's worth saying plainly rather than editing out of the story:
Bedrock access got blocked by an account-level eligibility hold — a restriction new AWS accounts without billing history run into, unrelated to which model you're requesting. I filed a support case, tried the (unofficial but reported) fix of triggering a small EC2 instance to verify the account, and confirmed the restriction was account-wide, not model-specific, by testing Amazon's own Nova models and hitting the identical error.
WeMakeDevs confirmed Bedrock isn't actually mandatory for eligibility, so I pivoted to calling an LLM API directly instead. First attempt hit a billing wall. Second attempt got blocked by a Cloudflare firewall rule — Python's default HTTP client sends a User-Agent string that reads as non-browser traffic and gets flagged. Fixed that, then hit a deprecated model name that had been retired for free-tier accounts three months earlier. Each of these is logged, with the real error text, in Recourse's own audit trail — the same append-only log the architecture uses for actual disputes now has a record of its own build process failing and recovering, which felt like a fitting place for it to live.
The numbers
Precision and recall on 20 held-out synthetic disputes both come out to 1.0. Worth being honest about what that does and doesn't mean: this is a deterministic rule engine, not a trained model generalising to unseen data, evaluated against synthetic cases with unambiguous ground truth. A correctly implemented deterministic system scoring close to perfect on clean-cut cases is expected behaviour, not a claim that it's infallible on messier real-world data.
What I'd build next
Real mandate revocation mid-transaction. Partial refunds instead of binary contest/accept. Confidence calibration against genuinely ambiguous cases, not just clean synthetic ones. And eventually, the actual Bedrock integration this was originally meant to use — the account hold will clear eventually, and the whole system was built provider-agnostic specifically so that swap is a config change, not a rewrite.
Repo: https://github.com/NehalAjmal/Recourse  ;
Live demo: https://master.d285ptzirlim8s.amplifyapp.com
Built for Bharat Builds Tour — First Commit, WeMakeDevs × AWS Builder Center.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article