💡 Inspiration

Shopping is turning into delegation. We already ask AI for recommendations — but the transaction itself is still a dozen manual clicks. AgentCart explores the next step of agentic commerce: an agent that can actually buy, within a budget, while keeping a human in control at the only moment that matters — the payment approval.

🤖 What it does

From one natural-language goal, AgentCart:

  1. Parses the budget from the goal and plans which product categories to cover.
  2. Builds the cart — best value-per-dollar, in-stock items only, no duplicates.
  3. Negotiates: when items do not fit the remaining budget, a merchant-bot grants a 5% bundle discount on the priciest item, freeing budget to unlock skipped needs.
  4. Handles curveballs: if an item goes out of stock right before payment, it substitutes the best-rated alternative in the same category.
  5. Checks out with PayPal Orders v2: creates the order, hands the buyer the approval link (human-in-the-loop), captures the payment after approval.
  6. Handles after-sales: partial refunds against the capture.

The agent never exceeds the budget — totals are enforced before the order is created.

It ships with two interchangeable brains over the same tool surface: a fully deterministic scripted planner (default — zero API keys, reproducible demo) and an optional LLM tool-calling planner (OpenAI or Mistral, bring-your-own-key) that discovers the same catalog, cart, and order tools on its own.

🛠️ How we built it

  • Express + TypeScript, zero database — runs anywhere Node 20 runs; judges can clone and run in one command.
  • PayPalGateway interface with two implementations: LiveSandboxGateway (real PayPal Orders v2 REST, OAuth, create/approve/capture/refund) and MockGateway (identical shapes, no credentials) so the demo works with no setup.
  • Agent interface behind a factory: AGENT_MODE=scripted|openai|mistral.
  • Single-page demo UI: chat-style timeline of every plan/think/tool event, live cart, and approve/capture/refund buttons.
  • Sandbox hard-lock: the config throws unless PAYPAL_ENV=sandbox; live credentials are unreachable by design.
  • Secrets only via gitignored .env; nothing sensitive is ever committed.

🧗 Challenges we ran into

  • PayPal sandbox buyer-account quirks: the default personal account login can fail — fixed by creating a fresh personal sandbox account (custom password) or using the documented test card.
  • Making the negotiation pass genuinely budget-driven: candidates must be re-evaluated against the post-discount budget, otherwise the discount never unblocks anything.
  • Keeping the LLM brain within budget and deterministic enough to demo: budget is re-enforced at order creation regardless of what the model planned.

🏅 Accomplishments we are proud of

  • Live PayPal sandbox E2E verified: order 3XA416430K812670T ($151.00) → buyer approved via sandbox checkout → capture 3P1350517S677384W COMPLETED (fee $4.68, merchant net $146.32) → partial refund 2XC90073EW226054H ($29.00).
  • The flagship negotiation demo: goal "home office for $200" → desk + stool picked, three needs skipped → 5% discount negotiated on the desk ($149 → $141.55) → keyboard unlocked → total $199.55, within budget.
  • Judges can reproduce everything with zero credentials (mock mode), or plug their own sandbox keys for the live flow.

📚 What we learned

  • Agentic commerce is really a budgeting + trust problem, not a browsing problem. The interesting decisions happen when money runs out: what to drop, what to negotiate, what to substitute.
  • Tool-calling loops over a small, well-typed tool surface (get_catalog, add_to_cart, create_order, finish) are enough for an LLM to shop sensibly — with guardrails doing the real work.

What is next for AgentCart

Real merchant catalogs, persistent carts across sessions, multi-merchant split payments, and an approval experience tailored for delegated purchases.

Built With

Share this project:

Updates

Submission history