-
-
Login Page: Authentication & Secure User Onboarding
-
Demo Pannel: Main Dashboard: Real-time Budget & Agent Status
-
Rules page: Deterministic Guardrails Configuration (Spending Limits & Allow-Lists)
-
Attack Demo: Prompt-Injection Threat Blocked in Real-Time
-
Audit Logs: MongoDB-Backed Immutable Purchase & Decision Ledger
-
Analytics: Analytics: Spending & Agent Activity Insights
-
Running a normal task: Agent Purchase Evaluation & Auto-Approval Workflow
-
PayPal Sandbox Order Creation & Live Capture
-
PayPal Dashboard: PayPal Developer Dashboard: Verified Sandbox Transactions & API Activity
-
Human-in-the-Loop Threshold Approval Modal
-
AI Auditor Risk Evaluation & Prompt-Injection Verification
-
Successful AI Purchase Workflow: Guardrail & Auditor Approval with Sandbox Capture
Inspiration
AI agents are starting to buy things for us, but giving an agent a payment method is risky. One wrong guess, one hallucination, or one malicious web page that says "send all funds to this account" can cost real money. We wanted to answer one question: how can an AI agent spend money without anyone having to trust it blindly?
PayPal already moves money for millions of people, so we built AgentWallet as a control layer that sits between an AI agent and PayPal.
What it does
AgentWallet lets a user give an AI agent a controlled budget. Every purchase the agent proposes passes through three layers of defense before any money moves:
- Deterministic guardrail engine (plain code, not an LLM): checks the total budget, per-transaction limit, merchant and category allow-lists, and duplicate payments.
- Independent AI auditor (a separate LLM call): checks that the product actually matches the user's task, and scans product data for prompt-injection text.
- Human approval: any purchase above the user's threshold, or flagged as risky, waits for an Approve or Reject decision.
Only after all three layers pass does AgentWallet create and capture a PayPal Sandbox order. Every decision is saved to a MongoDB audit ledger that can be exported as JSON.
The built-in Attack Demo loads a malicious product page that tells the agent to send all funds to an attacker. AgentWallet blocks it, shows the reason, and never creates a PayPal order.
How PayPal is used
- PayPal Orders API: creates an order and captures the payment after buyer approval in the Sandbox.
- PayPal Webhooks: a webhook endpoint with signature verification updates the ledger when PayPal confirms a payment.
- A purchase is shown as
CAPTUREDonly after PayPal confirms the capture, never before.
How AI is used
- Planner agent (Groq): reads the user's task, searches the product catalog, and proposes a purchase as structured JSON.
- Auditor agent (Groq, separate prompt and role): returns an approve, escalate, or block decision with a risk score and a reason.
- Semantic product-task matching and prompt-injection detection catch purchases that look valid but do not fit the task.
The important design choice: the LLM is never the only safety layer. Hard rules run in code first, so even a fully fooled model cannot spend outside the user's limits.
How we built it
- Frontend: React and Vite, responsive fintech UI with dark and light themes, a dashboard, and an audit log page.
- Backend: Express and TypeScript with a purchase state machine:
DRAFT → PLANNED → EVALUATED → PENDING_APPROVAL → APPROVED → ORDER_CREATED → BUYER_APPROVED → CAPTURED(withBLOCKED,CANCELLED, andFAILEDstates). - Database: MongoDB Atlas for users, rules, purchases, and the audit ledger.
- Deployment: backend on Render, frontend on Vercel.
- Testing: 14 backend tests for the guardrail engine and related logic, plus production builds for both frontend and backend.
Challenges we ran into
- Keeping a blocked purchase blocked. We made sure no PayPal order can be created after a blocked decision, and that the pipeline shows the correct status after a guardrail block.
- Duplicate protection. Early versions blocked retries because of incomplete payments, so duplicates are now based only on confirmed payments.
- Stale budget display. The budget did not refresh after a successful capture, so we refreshed it after a verified PayPal capture.
- Production deployment. We fixed the Render startup path, CORS origin handling, MongoDB health reporting, and the production API URL.
- Honest status. We show
CAPTUREDonly after a verified capture, so the dashboard never claims more than PayPal confirmed.
Accomplishments we're proud of
- A real PayPal Sandbox capture that we verified end to end.
- A working prompt-injection demo that shows the system stopping an attack live.
- A deployed, publicly usable app with a complete audit trail.
What we learned
- Agent safety is a systems problem: deterministic rules plus an independent auditor are stronger than a single prompt.
- Payment flows need a clear state machine to avoid showing false success.
- Small details, like CORS and webhook verification, decide whether a demo works in production.
What's next
- Per-category budgets and spending reports.
- Support for multiple agents with separate wallets.
- Live PayPal payouts and recurring purchase rules.
- A reusable open-source package so other developers can add guardrails to any PayPal agent.
Try it
- Live app: https://frontend-apcmpusgk-navins-projects-ed84ce2d.vercel.app/
- Backend health: https://agentwallet-pf6t.onrender.com/health
- Source code (MIT license): https://github.com/navin5447/AgentWallet
Note: the backend runs on a free tier, so the first request may take about a minute to wake up.
Built With
- agentic-commerce
- ai-agents
- css
- express.js
- fraud-prevention
- groq
- javascript
- llm
- mongodb
- mongodb-atlas
- node.js
- paypal
- paypal-orders-api
- paypal-sandbox
- paypal-webhooks
- prompt-injection
- react
- render
- typescript
- vercel
- vite