Inspiration
AI agents that buy things raise one obvious question: how do I trust them with my money? I wanted an agent that does the boring part of shopping (searching, comparing, building the cart) but can never spend more than I allow and never pays without my approval.
What it does
You tell CartPilot what you need in plain English, e.g. "a birthday gift for my sister who loves reading, under $40". The agent searches a 217-product catalog, compares items, fills the cart and prepares a PayPal checkout.
- Conversational shopping agent with six tools:
search_products,add_to_cart,remove_from_cart,view_cart,set_budget,ready_for_checkout - Live agent activity log so every action the AI takes is visible
- Product cards in chat with photos, price and rating, plus one-click swaps from the other options the agent found
- Wishlist and order history with PayPal order IDs
- Pay with PayPal: the shopper approves the payment in PayPal's own window, and the receipt shows the PayPal order and capture IDs
Layered guardrails
- Tool guardrail -
add_to_cartrejects anything that would break the spending limit, so the model can't talk its way past it. The same check applies to the shopper's own clicks. - Server-side re-pricing - when a PayPal order is created, the server re-prices every item from its own catalog and re-checks the limit. Prices from the browser or the AI are never trusted.
- Human approval through PayPal - the agent only gets as far as
ready_for_checkout. Only the shopper can approve a payment, and the PayPal button is hidden while the cart is over the limit.
How I built it
- Backend: Node.js + Express. An agent loop uses Google Gemini function calling (
gemini-3.5-flash, with other free-tier Gemini models as automatic fallbacks) to understand the request, choose searches, pick well-rated items within budget and write the reply. - PayPal: JavaScript SDK Smart Payment Buttons in the browser; PayPal REST Orders v2 on the server with OAuth2 client credentials, itemized
purchase_units,intent: CAPTURE, idempotentPayPal-Request-Id, and capture after approval (Sandbox). - Catalog: a local catalog plus ~180 products with photos from DummyJSON, with local fallback if DummyJSON is down.
- Frontend: vanilla JS. Hosting: Render blueprint included.
Challenges
- Free-tier AI limits: I built a model fallback chain, a retry on per-minute rate limits, timeouts for stuck calls, and an offline planner so the app still works with no AI available.
- Keeping the agent efficient: a typical request takes 2 Gemini calls; the loop is capped at 4 steps and the last steps can only add to the cart or reply.
- Sandbox quirks: an app's own Business account can't pay itself, and India-based sandbox buyers can fail on domestic payments, so testing uses a US Personal sandbox buyer.
What I learned
Guardrails for agentic payments belong in the tools and on the server, not in the prompt. Combining hard limits with PayPal's human approval step makes an AI agent safe to hand a wallet to.
What's next
- A database for carts, wishlists and orders
- Real merchant catalogs (Shopify, Channel3)
- PayPal Vault so a trusted agent can make small recurring purchases within rules you set, plus per-category spending limits
Log in or sign up for Devpost to join the conversation.