Inspiration

Most money apps tell you what you spent. But if you live on a single income or gig work, the question that matters is "should I spend this, right now?" One purchase at the wrong time can mean a missed bill a week before payday.

I wanted an assistant that behaves like a careful CFO: it looks at the whole month before answering, shows its math instead of just giving an opinion, and helps you act, without ever moving money on its own. PayPal's APIs made the "act" part real, and tool-calling LLMs made the "decide and explain" part possible.

What it does

Pilot is a chat-driven AI CFO. You ask in plain English ("Can I afford a $999 e-bike?") and it:

  • Decides: projects your balance to month end and answers Yes / Wait / No with the reasons.
  • Shows: rebuilds a live dashboard for every question: KPI tiles, charts, AG Grid tables with grouping and pivot, and a cash-flow timeline with a safety line.
  • Acts: drafts a PayPal order for a purchase, or spots a recurring bill and proposes PayPal autopay. Nothing is created until you click Approve.

The math behind a verdict

Pilot projects the balance at month end if you buy now:

$$ B_{\text{end}} = B_{\text{now}} - \sum_{i} \text{bill}_i - d \cdot \bar{s} - P $$

where \(B_{\text{now}}\) is today's balance, the bills are the ones still due this month, \(d\) is the days left in the month, \(\bar{s}\) is your average daily spending over the last 90 days, and \(P\) is the price. The verdict compares that with your monthly income \(I\):

$$ \text{verdict} = \begin{cases} \textbf{No} & \text{if } B_{\text{end}} < 0.15\,I \ \textbf{Wait} & \text{if } B_{\text{end}} < 0.30\,I \ \textbf{Yes} & \text{otherwise} \end{cases} $$

With the demo data (\(B_{\text{now}} = \$2{,}000\), \(\$81\) of bills left, about \(\$799\) of everyday spending, \(I = \$3{,}200\)), a \(\$999\) purchase leaves about \(\$121\), under the \(\$480\) buffer, so the answer is No: wait for payday.

How I built it

  • The agent: [your model] with tool calling runs up to 6 tool rounds per question, using typed, zod-validated tools: query_transactions, project_cashflow, find_product, affordability_verdict, detect_recurring, propose_paypal_order and propose_autopay. The verdict numbers come from tool results, never from the model's imagination.
  • Generative UI: the model designs the dashboard by returning a JSON DashboardSpec. The server validates it, lets the model repair it once if it's invalid, then streams it to the browser over Server-Sent Events, where widgets animate in.
  • PayPal integration:
    • Orders v2: create, buyer approval in a popup, capture.
    • Catalog Products, Billing Plans and Subscriptions for autopay.
    • Webhooks, each delivery checked with PayPal's signature-verification API.
    • Live status of orders and subscriptions, pushed to the card as it changes.
    • Transaction Search and the Balances API, which load the sandbox account's real activity and balance on every start.
  • The model only proposes. Every PayPal call happens after a human clicks Approve, and all secrets stay on the server.
  • Stack: React, Vite, TypeScript, Framer Motion, AG Grid and AG Charts; Express and TypeScript; deployed on Render, with a Postman collection for every endpoint.
  • Runs without keys: every service is optional. With no keys, Pilot runs on seed data, a scripted agent that calls the same tools, and simulated webhooks in PayPal's own event format, so anyone can try it with npm install && npm run dev.

Challenges I faced

  • Making generative UI safe. An LLM building the interface can produce broken layouts. Strict schema validation, a single repair attempt and a deterministic fallback mean the user never sees a blank dashboard.
  • Models skipping steps. Live models sometimes gave the right verdict but forgot to propose the payment, leaving no button. Pilot now fills in that step from the model's own tool results, still as a proposal the user has to approve.
  • PayPal sandbox realities.
    • Payments failed with "seller doesn't accept payments in your currency" until I used US sandbox accounts.
    • Webhooks need a public HTTPS endpoint plus signature verification.
    • Transaction Search has to be enabled per app before reporting calls work.
  • Keeping the user's place. Returning from PayPal originally reloaded the whole app in a new tab. Now PayPal opens in a popup, which reports back and is closed by the Pilot tab, so the conversation stays intact.
  • Free hosting. Render's free plan sleeps and resets its disk, so Pilot reloads the balance and transactions from PayPal on every start and saves its own state while it runs.

What I learned

  • Agentic commerce works best when the AI decides and explains, and the human approves. Showing the math builds more trust than a confident answer.
  • Give the model tools for facts and a schema for output. It is much more reliable as an orchestrator than as a calculator.
  • Design for failure from day one: when every external service has a fallback, the demo never dead-ends.

What's next

  • Log in with PayPal and a database for multiple users.
  • Bank-account data with user consent.
  • A user-set safety buffer instead of fixed percentages.
  • Live PayPal payments after account review.

Built With

  • ag-charts
  • ag-grid
  • ai-agents
  • express.js
  • framer-motion
  • kokoro-tts
  • lucide-react
  • node.js
  • openai/gpt-4o-mini
  • paypal
  • paypal-orders-api
  • paypal-subscriptions-api
  • paypal-transaction-searchopenai-compatible-api
  • paypal-webhooks
  • postman
  • react
  • render
  • server-sent-events
  • tailwindcss
  • tool-calling
  • typescript
  • vite
  • zod
Share this project:

Updates

Submission history