Inspiration

Small businesses pay suppliers and freelancers through PayPal on thin margins. One wrong payment (an invoice paid twice, a misread amount, or a supplier's email quietly swapped by a fraudster) can wipe out a week's profit. AI agents that "just pay" make this worse: a model can misread "$45" as "$450", or be talked into ignoring its rules by a line hidden in an invoice. We wanted the speed of an AI agent with the caution of a careful bookkeeper.

What it does

Type a request in plain words, or upload a supplier's invoice (PDF or photo):

  • Pay a supplier: "Pay my supplier Acme Supplies $45 for the packaging order, invoice INV-1042"
  • Get paid: "Invoice Maria Lopez Design €250 for the logo design"
  • Ask: "Have I already paid Kamau Logistics this week?"

The agent looks things up first (saved payees, payment history, today's budget, existing PayPal invoices) and shows each step. Then fixed rules, not the AI, check the proposal. You approve, and PayPal carries it out: Payouts for suppliers, Invoicing for clients, Checkout for someone new. Every step goes into a hash-chained, tamper-evident audit trail.

What it stops:

  • Hidden instructions, in a request or as invisible text inside a PDF
  • Invoice scams: a known supplier suddenly asking to be paid at a new email
  • Paying twice: the same invoice number, or the same amount to the same person this week
  • Made-up details: every amount and email must appear in the owner's words, the invoice, or the saved payees

Insights, built with AG Studio, shows what the rules stopped, flagged and paid, with custom PayPilot widgets and an AI assistant that hands safety questions to our own Risk analyst agent.

How we built it

  • Agent: Groq (gpt-oss-20b) with tool calling. Read-only tools to look things up; it can only propose, never move money.
  • Policy engine: pure Python rules (injection scan, amount and email grounding, changed-payment-email check, limits, duplicate and repeat detection, new-payee review). They run when a proposal is made and again right before PayPal is called.
  • Invoice reading: pypdf plus Groq; photos go to a Groq vision model. Every figure must appear on the page.
  • PayPal: Payouts, Invoicing v2 and Orders v2, with idempotency keys, an atomic "executing" state against double payment, and automatic detection when a client pays an invoice.
  • AG Grid for the ledger; AG Studio for Insights, with two custom widgets (a safety funnel and a live audit-chain check) and the Studio Agent Framework: Studio's agents run on Groq through our API (the key never reaches the browser), plus a custom Risk analyst agent with its own PayPilot tools.
  • Stack: FastAPI, SQLite, Next.js 16, Tailwind 4, deployed on Render. A rule-based backup parser keeps it working if the AI is unavailable.

Challenges

  • Making the AI useful without letting it hold the pen: amounts and emails are always re-checked by code.
  • Testing against the live AI showed it sometimes missed the "new payment email" line in a PDF, and once read "Invoice Maria…" as a payment. We added deterministic rules so both can never slip through.
  • Running AG Studio's agents on Groq's free plan meant keeping requests small and waiting out rate limits.

What we learned

The most useful thing AI can do in payments is the legwork: reading, looking up, cross-checking and explaining. The decision itself belongs to fixed rules and a person.

What's next

Recurring supplier payments, two-person approval for large amounts, Postgres for production, and confirming changed payment details with the supplier automatically.

Built With

Share this project:

Updates

Submission history