Inspiration

Agents can now shop and pay, but nobody wants to hand an LLM an unlimited card. AgentPurse lets a model propose payments while a deterministic policy decides whether money moves.

What it does

Describe a purchase in plain language. Gemini extracts payee, amount, category and risk flags. The policy engine allows payments within policy, holds requests above the approval threshold for a human, and denies blocked categories, hard-limit violations and prompt injection. Approved payments use PayPal sandbox Payouts. Receipts and an AG Grid audit trail show the decisions and PayPal identifiers. An MCP server exposes the guarded tools to other agents.

How we built it

Python/FastAPI, vanilla JavaScript, AG Grid Community, PayPal OAuth2 and Payouts create/get/cancel APIs, Gemini and MCP over stdio. 12 tests pass covering policy, service and API behavior. The final narrated demo uses gemini-3.5-flash-lite; the configurable default is gemini-3.5-flash. A labelled deterministic parser permits keyless offline evaluation. Model failures are labelled and require human approval.

Key design choice

The model output is untrusted input. Deterministic checks control payments, a regex backstop catches manipulation, and approval rechecks the budget. The model cannot override spending policy.

Challenges and limitations

Sandbox card processing was unavailable for this merchant, so we used Payouts. Cancellation is possible only for UNCLAIMED payout items. When PayPal refuses cancellation, the app records refund_requested rather than claiming a refund succeeded. Fake sandbox vendor emails can leave payouts PENDING. This is a sandbox prototype, not a production payment system.

What's next

Per-agent policies, better payment reconciliation and human approval notifications.

PayPal and AI

PayPal executes approved sandbox payouts and exposes their status and cancellation. Gemini converts natural language to structured payment proposals and flags risk. Human-controlled policies connect the two.

Demo

Public narrated walkthrough, 2:12: https://www.youtube.com/watch?v=5stUM8M1eBs

Built With

Share this project:

Updates

Submission history