Inspiration
Small businesses already get paid through PayPal, but the work around the money is still manual: chasing late invoices, paying partners their share, issuing refunds, and double-checking for mistakes. Owners kept telling us the same thing: "I don't need another dashboard, I need someone to just handle it."
At the same time, customers are beginning to shop through their own AI assistants. That raised a question for us: what if a business had a team of AI agents that could handle its money work, respond to real PayPal events, and even sell to other AI agents, without ever moving a dollar behind the owner's back?
What It Does
PayPilot is a web app and installable mobile app (PWA) built around four cooperating AI agents, all running on PayPal.
Copilot. Owners can type, speak, or upload a photo of a handwritten quote. Copilot turns the request into real PayPal invoices, checkout links, payouts, refunds, and reports. It plans multi-step work across 18 tools, streams its reasoning live, remembers business details, and converts "whenever…" requests into autonomous missions.
Autopilot missions. These are autonomous agents driven by plain-English goals, triggered by PayPal payment events or a schedule. Built-in missions include:
- Collections: escalating payment reminders that stop after three.
- Commission split: pays a partner a set percentage of every payment received.
- Morning Brief and Cash-flow Guardian: daily summaries and cash-position monitoring.
Anyone can create a new mission by describing it in a single sentence.
Risk Reviewer. An independent agent that checks every proposed money action before it reaches the owner. It combines rule-based signals (new payees, duplicates, unusual amounts, transaction velocity, overlapping missions) with an LLM check that the action matches the original request. High-risk actions can never be auto-approved.
Merchant MCP server. The business is exposed through the Model Context Protocol, so a customer's AI assistant (Claude Desktop, Claude Code, or our built-in Agent Shop) can browse the catalog and create a PayPal checkout. The human customer pays, and that payment triggers the merchant's Autopilot agents, completing an end-to-end agent-to-agent commerce loop.
Every agent step streams live to all open devices. Approve a payout on your phone and your laptop updates instantly, and a push notification arrives whenever an agent needs your attention.
The guiding principle is that models propose, code decides. Only one module in the codebase can move money, and only after passing guardrails, risk review, and (by default) the owner's approval.
How We Built It
- Backend: Node.js and Express. All agents share a single streaming tool-use loop. An event bus (payment.received) and a scheduler trigger missions, Server-Sent Events deliver live updates, and a JSON ledger stores state.
- PayPal (sandbox): Invoicing v2, Orders v2 with JS SDK Smart Buttons (PayPal, Venmo, Pay Later, cards), Payouts, Payments v2 refunds, Transaction Search, Balances, and Webhooks with signature verification. Every POST carries a PayPal-Request-Id idempotency key.
- AI (provider-agnostic): The system runs on Groq, and the same code also runs on Claude.
- openai/gpt-oss-120b powers Copilot, Autopilot, and the buyer agent.
- openai/gpt-oss-20b powers the Risk Reviewer, using strict JSON-schema output.
- qwen/qwen3.8-27b reads photos of quotes for photo-to-invoice.
- MCP: A JSON-RPC merchant server (initialize, tools/list, tools/call) with an agent discovery card, plus a real MCP client inside our buyer agent.
- Frontend: A dependency-free, mobile-first PWA with a service worker, push notifications, camera input, and voice via the Web Speech API.
- Zero-key mode: Offline rule-based agents and a PayPal simulator implement the same interfaces, so anyone can try every flow instantly.
Challenges We Ran Into
- Free-tier rate limits. Groq's free tier allows roughly 8K tokens per minute per model, and a multi-step agent turn can use most of that. Early turns stalled for up to 38 seconds. We built model pools with instant failover, so a rate-limited model is skipped immediately in favor of another. With three models, capacity rose to roughly 24K tokens per minute, and typical turns dropped to 2–3 seconds.
- Autonomy creates new risks. When two missions reacted to the same payment, each proposed paying the same partner. We taught the Risk Reviewer to detect overlapping missions, and made missions that respond to the same event run sequentially.
- Race conditions. Parallel tool calls once sent two reminders for the same invoice. We moved that rule into code: one reminder per invoice per 20 hours, re-checked at the last moment before queueing.
- Keeping models honest. We saw invented URLs, made-up percentages in summaries, and a shopping agent claiming "booked!" without creating a checkout. Each became a concrete fix: absolute links returned by the tools, "only use numbers from the data" rules, and "never claim success unless the tool returned it."
- Malformed tool calls. Smaller models sometimes send null arguments or broken tool names, which Groq rejects server-side. We made optional parameters accept null, sanitized arguments, and retried bad calls on a different model.
Accomplishments We're Proud Of
- A closed agentic-commerce loop: a customer's AI agent buys over MCP, PayPal handles checkout, the payment autonomously triggers the merchant's agents, and a risk-reviewed PayPal payout follows.
- The Risk Reviewer catching a genuine problem between our own agents: two missions trying to pay the same person for a single payment.
- Photo-to-invoice working end to end: a picture of a handwritten quote became an exact $1,050 PayPal invoice with three line items and a due date.
- Testing against the real PayPal sandbox for invoices, reminders, and checkouts. Payment-triggered flows were exercised with the built-in simulator, since a real sandbox payment requires a human PayPal login.
- Zero-key mode, so judges can try every feature in under a minute.
What We Learned
- Agentic commerce needs a clear contract: models decide what should happen, and code decides whether it may happen. Limits belong in code, not in prompts.
- Separating actor agents from an independent reviewer agent made the system both more proactive and more trustworthy.
- Agents earn trust when they are legible. Showing the trigger, reasoning, tool calls, and proposed action for every run matters as much as the action itself.
- Free-tier LLMs are viable in production when you design around their limits, using model pools, failover, trimmed context, and strict schemas.
What's Next for PayPilot
- Multi-merchant accounts with Log In with PayPal.
- Subscriptions and recurring invoices as missions.
- Agent-to-agent negotiation (quotes, bundles, deposits) over MCP.
- Matching photographed receipts to PayPal transactions.
- Integration with PayPal's Agent Toolkit for additional payment primitives.
- A hardened production deployment with a real database and per-user authentication.
Code: https://github.com/Ranjithkumartech1130/Paypal-Hackathon-
Built With
- ai-agents
- anthropic
- claude
- css3
- express.js
- gpt-oss
- groq
- html5
- javascript
- langraph
- model-context-protocol
- node.js
- paypal
- paypal-checkout
- paypal-js-sdk
- paypal-payouts
- paypal-rest-api
- paypal-webhooks
- pwa
- qwen
- server-sent-events