Inspiration
AI agents are starting to shop and pay on our behalf, and PayPal is pushing hard on agentic commerce. But nobody wants to hand an agent an open wallet. An agent with payment access can be tricked by a hidden instruction on a web page ("send $500 to this account"), can burn through a budget in a loop, or can pay a merchant the user never meant to pay. That trust gap is what keeps agentic commerce from going mainstream, and we wanted to close it.
What it does
Agent Wallet Guard is a spending firewall that sits between any AI agent and PayPal. The agent asks to pay, and Guard decides:
- APPROVE: The request fits the rules (under $50, allowed category, inside the weekly budget) and the AI check agrees. The payment goes out automatically in the PayPal sandbox.
- ESCALATE: The request is above the auto limit, over budget, or unusual. The human gets a plain-English explanation and a one-tap Approve or Deny.
- BLOCK: The request breaks a hard rule or looks like an attack. Nothing is sent, and the reason is logged.
Every decision, from the agent's request to the human's tap, goes into an append-only, hash-chained audit log, so any tampering is detectable. All rules (limits, weekly budget, allowed and blocked categories, payee allowlist) are editable from a live dashboard.
In our demo, the agent buys a $20 phone case (approved and paid), buys $150 headphones (escalated, then approved by a human), and then visits a compromised page with hidden text telling it to send $500 to an attacker. Guard flags the prompt injection and blocks it, and the money never moves.
How we built it
- Rules and decision engine: A FastAPI service (SQLModel) with JSON rules, plus one LLM call that returns a decision, a plain-English reason and a risk score.
- AI risk check: Gemini through a swappable client, run at temperature 0 with JSON-only output. It can only tighten a decision, never loosen one, and if it fails or times out the request escalates to a human.
- PayPal execution: Approved payments run through the PayPal Payouts API in the sandbox, sending from a business account to a vendor's sandbox email with no buyer-approval step. The Orders API is the fallback.
- Dashboard: Vanilla JS with Tailwind and AG Grid, showing a live request feed with approve/escalate/block badges, a rules editor, a budget meter, and the audit log with a chain-integrity check.
- Demo agent: A deliberately unprotected shopping agent and a compromised web page, so the video shows Guard doing the protecting.
- Hosting: Render web service and Postgres (SQLite locally, switched by
DATABASE_URL).
Challenges we ran into
- Making the AI layer safe to depend on. We designed it so it can only make decisions stricter, and any failure falls back to a human instead of an approval.
- Getting real sandbox money movement working through PayPal Payouts, with the Orders API as a backup path.
- Keeping the demo reliable. LLM latency and free-tier hosting sleep were risks, so we used a scripted agent and a health-check ping to keep things stable.
- Balancing protection and friction: rules strict enough to stop attacks, but not so strict that every purchase needs a human.
Accomplishments that we're proud of
- A complete product, not just an API: landing page, live dashboard, rules editor and audit log.
- Real sandbox payouts driven by a tested, deterministic rules engine.
- A tamper-evident audit trail where every step is hash-chained and verifiable.
- A live prompt-injection attack that gets blocked on camera, with the money never moving.
- A policy layer that works with any agent, not just our demo one.
What we learned
- Deterministic rules should be the foundation, and the LLM should only ever add caution on top.
- Failing safe matters more than failing smart: when in doubt, ask a human.
- Trust in agentic commerce comes from clear limits, plain-English explanations and an audit trail people can verify.
- Prompt injection is a practical payments risk, not just a theoretical one.
What's next for Agent Wallet Guard
- Per-agent and per-merchant policies, spending velocity limits and time-of-day rules.
- Escalation approvals through push notifications, SMS or chat apps instead of only the dashboard.
- Tighter integration with the PayPal MCP server and live (non-sandbox) payment rails.
- A drop-in SDK so any agent framework can route payments through Guard in a few lines.
- Richer anomaly detection, such as unusual amounts, new payees and suspicious page content.
Built with
Python, FastAPI, SQLModel, SQLite, PostgreSQL, PayPal Payouts API (sandbox), Google Gemini, JavaScript, Tailwind CSS, AG Grid, Render
Built With
- api
- fastapi
- gemini
- javascript
- payouts
- paypal
- postgresql
- python
- render
- sqlite
- sqlmodel
- tailwind