Inspiration

AI agents are starting to shop for us, but nobody wants an agent with an open wallet. If an AI can pay for things, what stops it from buying something we never asked for, or blowing past our budget? We wanted a safe pattern for agentic commerce: let the AI do the shopping, but keep the human in charge of the money.

What it does

GuardRail Shopper is an AI shopping agent that buys through PayPal, but only inside rules you set. You type what you want in plain English, such as "a gift under $30". The agent searches a catalog and proposes a purchase, and a rules engine on the server decides what happens:

  • Auto-approved: within budget and under your auto-approve limit.
  • Needs your approval: above the auto-approve limit, so you click Approve or Reject first.
  • Blocked: over the per-purchase cap, over the total budget, or in a blocked category (like alcohol).

Approved items are paid with PayPal's sandbox checkout and the payment is captured after approval. Every search, proposal, decision, order and payment is recorded in an audit log. You can edit the rules live (total budget, per-purchase cap, auto-approve limit, blocked categories) and ask again.

How we built it

  • PayPal: PayPal Orders v2 API (sandbox). The server creates the order, the buyer approves it on PayPal's checkout page, and the server captures the payment on return. A webhook endpoint with PayPal signature verification is included.
  • AI: The agent runs on Groq (openai/gpt-oss-120b) using tool calling with two tools, search_products and propose_purchase. The model proposes, but the server decides.
  • Rules engine: A separate module enforces the budget, cap, approval threshold and blocked categories, so the AI cannot talk its way around them. It has unit tests.
  • Honesty check: If the agent claims to have proposed, approved or blocked something without actually calling the tool, the server catches it, logs it and makes the agent correct itself. We found this when the model described a purchase that was never recorded.
  • No filler purchases: The agent is told never to propose unrelated items; a search cap stops it from guessing endlessly when nothing matches.
  • App and hosting: Node.js and Express, with a plain HTML/JS interface (skeleton loaders, light theme). Deployed on Render.

Challenges we ran into

  • AI that sounds sure but did nothing. The model sometimes said "I proposed it" without calling the tool. We added a server-side honesty check and tightened the prompt.
  • An agent that wanted to please. When nothing matched ("a diamond rig"), it once proposed an unrelated item. We fixed it so it says nothing matched and stops.
  • PayPal sandbox currency. Sandbox accounts created for India couldn't accept USD payments. We created US sandbox accounts and a new REST app to fix it.
  • Free-tier limits. Groq's free tier has a token-per-minute limit, so the agent retries when rate-limited.

Accomplishments that we're proud of

  • A working end-to-end flow: AI agent, server-side guardrails, real PayPal sandbox order and captured payment.
  • Guardrails that don't depend on the AI behaving well.
  • An audit trail that makes every agent decision visible.

What we learned

For agentic commerce, the trust boundary matters most. The model should propose, and deterministic code should hold the money. It is also worth verifying what an agent says it did against what actually happened.

What's next

  • Real product data (for example a product-search API) instead of a mock catalog of 16 items.
  • Per-user accounts and saved rules, instead of one shared demo session.
  • PayPal webhooks as the source of truth for payment status, and refunds.
  • Spending rules that vary by category, merchant or time.

Built With

Share this project:

Updates

Submission history