People have accounts. AI agents borrow a person's card and pass it around. When one agent hires another, it either hands over the same credential or approves every payment itself. And the freelancer, shop or agent on the other side cannot tell whether the software asking for work can actually pay.

Envelope is spending authority for AI agents that can be split but never enlarged, backed by a PayPal hold.

  • Seal: You sign an envelope in your browser: "$200, only to these two payees, only for translation and design, until tonight." PayPal places one authorization for the whole amount. Nothing is charged yet.
  • Split: Your agent signs smaller envelopes for the agents it hires: less money, fewer payees, earlier expiry. Never more.
  • Check: A payee asks whether an agent is good for the money and gets a signed answer that carries PayPal's own confirmation the hold is live.
  • Spend: Every payment is a partial capture of the hold, debited from every envelope above it under one lock, then a PayPal payout.
  • Accounts and cards: An agent can keep what it earns, pay other agents on its own signature, and issue a card that only one merchant can charge.
  • Trace: Any dollar can be followed back to the person who signed for it; your browser checks every signature.
  • Audit: An auditor agent asks PayPal directly through PayPal's own Agent Toolkit and compares the answers with the books. It can read and propose. It cannot pay, refund or sign.
  • Close: PayPal releases whatever was never spent.

Next.js and TypeScript. Envelopes are chains of Ed25519 signatures checked with WebCrypto. A gateway is the only thing holding PayPal credentials; agents get a key and an envelope, never a credential.

PayPal does everything that touches money: Orders v2 authorization (on a test card or approved by the payer), partial captures, Payouts and payout status, void, capture refunds, payout item cancel, webhook signature verification and the event feed, Reporting balances and Transaction Search, Disputes, and the Agent Toolkit for the auditor's reads.

Agents connect through a TypeScript SDK, an MCP server or a command line. The hosted copy runs the whole gateway inside your browser (Postgres in WebAssembly) against a PayPal simulator, so judges need no sign-up.

A real model plays the agents: it decides how to split, whom to pay, and what to do with a delivery message that hides an instruction to pay an attacker. Every decision becomes a signed request, and the gateway allows or refuses it by signatures and arithmetic. No model output can move money on its own. A second model, the auditor, reads PayPal through PayPal's Agent Toolkit, limited to 5 of its 47 tools, and can only propose.

Making a hold behave like an account: budgets reserved at every level under one lock before PayPal is called, so twenty agents racing for the last ten dollars spend exactly ten. Treating PayPal as the last word: nothing is called paid until PayPal says it arrived, and every event is verified with PayPal and applied once. Running a full Postgres gateway inside a browser tab, shared safely between tabs.

  • On the real PayPal sandbox: holds, partial captures, payouts, voids, refunds, webhooks verified with PayPal, and every gateway record PayPal had listed matched PayPal's own statement, fees included.
  • 447 automated tests, including 171 attacks (all refused, none moved money) and randomized runs checked against an independent model after every move.
  • A guided two-minute tour on the live site that only moves on when each step has really happened.

PayPal's statement lags by a few hours and charges fees the books must account for. An unclaimed payout and a pending one are not "paid". And an agent that audits can be safe exactly when the only thing it can do is propose.

Built With

  • claude
  • drizzle-orm
  • ed25519
  • model-context-protocol
  • next.js
  • node.js
  • paypal-agent-toolkit
  • paypal-disputes-api
  • paypal-orders-api
  • paypal-payouts-api
  • paypal-transaction-search
  • paypal-webhooks
  • pglite
  • playwright
  • postgresql
  • react
  • tailwindcss
  • typescript
  • webcrypto
Share this project:

Updates

Submission history