Inspiration

AI agents can now shop for us, but a wallet that an agent can spend from is risky. It can overspend, be talked into a bad purchase, or be misled by text hidden on a web page. Today the choice is to hand the agent your card or not let it buy at all. AgentWallet is a middle path: a spending-rules wallet that sits between an AI shopping agent and your money.

What it does

  • You fund the wallet with PayPal Checkout.
  • You set the rules: how much the agent can spend alone, a hard per-purchase limit, a daily budget, allowed categories and blocked merchants.
  • The agent can only ask the wallet to buy. Every request gets one of three outcomes: paid automatically, held for your approval, or blocked, each with the reason in plain words.
  • A hostile product listing in the demo store tells AI agents to ignore their rules. Even if the agent obeys it, the wallet still blocks the purchase, because the decision is made by plain code and not by the model.

How I built it

  • Node.js 22, Express 5 and a vanilla JS front end, with no build step.
  • PayPal sandbox: Orders v2 (create, approve, capture) to fund the wallet, and Payouts to pay the merchant. The captured amount and currency are verified before any money is credited, and the purchase id is the payout batch id, so a retry cannot pay twice.
  • Claude tool use (Anthropic SDK): three tools (check the wallet, search the store, request a purchase). The agent can ask but cannot decide.
  • Policy engine: deterministic code, prices come from the store and not from the agent, funds are reserved before payout, and every decision is logged.
  • 44 automated tests cover the rules, the PayPal flows, crash recovery and hardening.
  • Security: owner-key gate, Origin checks, rate limits, CSP headers. Claude API keys are supplied by the user in the browser, sent per request, and never stored or logged.

Challenges

Making money flows safe under failure: a payout that times out, a capture that must be retried, a server crash mid-settlement. These are handled by reserving funds first and marking uncertain outcomes as "unconfirmed" instead of guessing.

What I learned

Safety for agents works best when it does not depend on the model behaving. The agent proposes, the rules decide.

Honest limits

The demo video runs in demo mode: a simulated PayPal checkout and a keyword stand-in agent. Live PayPal sandbox calls and the live Claude tool loop are implemented but I have not run them end to end. To go live, add your own PayPal sandbox keys and Claude key (see README).

What's next

Polling payout status, per-agent budgets, and multiple owners.

Built With

Share this project:

Updates

Submission history