-
-
The buyer approves a $60 ceiling once in PayPal Sandbox checkout (Orders v2, intent AUTHORIZE). The agent never sees it.
-
Agent at fault: it bought a Windows-only webcam for a MacBook user. Buyer refunded, operator’s bond pays the merchant. (Simulator mode)
-
Agent at fault: it bought a Windows-only webcam for a MacBook user. Buyer refunded, operator’s bond pays the merchant. (Simulator mode)
-
Audit ledger (AG Grid): every purchase, rule failure, PayPal id and verdict with totals. (Simulator mode)
-
Safe purchase on the PayPal Sandbox: all 7 rules pass, $51.84 captured with final_capture, $8.16 of the $60 hold released.
-
The buyer approves a $60 ceiling once in PayPal Sandbox checkout (Orders v2, intent AUTHORIZE). The agent never sees it.
-
Sentinel home: give your agent a budget, not your wallet. PayPal Sandbox and Gemini both live.
-
Hidden instruction blocked: a listing added a $14.99 yearly plan, R1/R3/R6/R7 failed, authorization voided. (Simulator mode)
Inspiration
AI agents can now shop for us, but every payment rail still assumes a human is clicking "Pay". Handing an agent your card is all-or-nothing, and when the agent buys the wrong thing, nobody owns the mistake: not the user, not the merchant, not the developer who built the agent.
We wanted to answer two questions:
- Before payment: how do you let an agent spend without handing it your wallet?
- After payment: when the agent gets it wrong, who pays?
What it does
Sentinel is a payment firewall and recourse layer for AI shopping agents, built on PayPal.
- Hold. The user types a request like "webcam under $60, USB-C, arriving this week, no subscriptions". Gemini turns it into typed, editable rules. The user approves a budget, not an item, and PayPal holds it as an authorization.
- Gate. The agent shops on its own but never touches PayPal. Every purchase it proposes passes seven deterministic rules: budget, category, no recurring charges, seller, delivery, listing integrity and live authorization state. If all pass, Sentinel captures only the final total and releases the rest. If any fails, the authorization is voided and nothing is charged.
- Recourse. If the user complains, an arbiter reads a tamper-evident flight recorder of what the agent saw and decides who is at fault. The buyer is refunded, and the cost lands on the agent operator's bond or on the merchant. Ambiguous cases go to manual review.
The guarantee: a PayPal authorization is never captured when the final transaction violates a hard rule of the user's mandate.
Three demo cases:
- Safe purchase: a $60 hold, a $48 webcam, all seven rules pass, $51.84 captured and $8.16 released.
- Hidden instruction: a sponsored listing secretly tells the agent to add a yearly protection plan. The total jumps to $74.39, four rules fail, and the authorization is voided.
- Wrong item, then refund: the agent buys a "Windows only" webcam for a MacBook user. The arbiter quotes the listing and the request, finds the agent at fault, refunds the buyer and pays the merchant from the operator's bond.
How we built it
- One Next.js + TypeScript app with one SQLite file, deployed on Render.
- PayPal: Orders v2 with
intent: AUTHORIZE, the PayPal JS SDK for buyer approval, live authorization re-checks, capture withfinal_capture: true, void, refunds through the Payments API, Payouts from a separate agent-operator account, and signature-verified webhooks. Every money-moving call carries aPayPal-Request-Ididempotency key. - AI (Gemini via the Vercel AI SDK):
- mandate extraction with structured output validated by zod (a budget is only accepted if it literally appears in the user's words)
- a tool-calling shopping agent with a careful profile and a "sloppy" red-team profile
- a prompt-injection classifier over untrusted listing text
- an evidence-quoting arbiter
- The trust boundary: the model never decides whether money moves. The policy engine does, in plain TypeScript, using only server-side data. AI can add a block but can never remove one.
- Flight recorder: every agent step, tool call, listing snapshot and payment action is appended to a SHA-256 hash chain. If any entry is altered, the arbiter refuses to judge.
- AG Grid powers the audit ledger: every mandate, decision, PayPal id, webhook and verdict, with totals and an outcome breakdown.
Challenges we ran into
- Holding a ceiling but charging the real price. The user approves $60, but the agent's purchase might cost $51.84. We authorize the ceiling, capture only the server-computed total with
final_capture, and let PayPal release the remainder, while re-checking the authorization live so an expired hold is never captured. - LLMs inventing evidence. An arbiter that "quotes" text that isn't there is worse than no arbiter. Every quote is now checked against the source, quotes that don't appear verbatim are discarded, and verdicts below a confidence threshold go to manual review.
- Prompt injection hiding in product listings. Seller text is untrusted input that the agent reads. We combined pattern checks with a Gemini classifier, designed so the classifier can only add a block, never clear one.
- Three parties, three PayPal accounts. Paying the merchant from an agent operator's bond needs Payouts on a separate business app, so the sandbox models a buyer, a merchant and an agent operator.
- Moving money exactly once. Retries and double clicks could capture or refund twice. State transitions are compare-and-set updates in SQLite, so a mandate can be run once and disputed once, and PayPal idempotency keys protect every money-moving call.
Accomplishments that we're proud of
- A complete money lifecycle on PayPal: hold, gate, capture or void, dispute, refund and bond payout.
- Catching a real model, our sloppy red-team agent, falling for a hidden instruction, rather than a scripted failure.
- Fault attribution that covers all four outcomes: agent at fault, merchant at fault, user responsible, or unclear and sent to manual review.
- A test suite covering the policy engine, injection scanner, hash chain, arbiter, PayPal client and full lifecycle, plus an end-to-end HTTP script that drives every scenario.
What we learned
- PayPal's authorize-then-capture model is a natural fit for agent spending: a hold is exactly the "budget, not wallet" boundary agents need.
- Deterministic rules with advisory AI are far easier to trust than AI alone. The model is great at reading messy text and should never be the final word on whether money moves.
- Accountability needs evidence. Without a tamper-evident record of what the agent actually saw, "who pays" is just an argument.
What's next
- Signed listing snapshots from merchants, so integrity checks don't depend on our own copy.
- Agent-operator bonds as a real staking or insurance product.
- Multi-item, multi-merchant and recurring mandates with per-merchant limits.
Runs on the PayPal Sandbox. No real money moves. The store, brands and products are fictional.