๐ก Inspiration
Small-to-medium businesses lose thousands of dollars annually due to stockouts, yet owners are rightfully terrified of handing a credit card to an AI agent to "auto-buy" supplies. We realized that true Agentic Commerce isn't just about autonomous executionโit's about enterprise-grade financial safety. We built Restock.ai to solve this: an AI agent that monitors, researches, and prepares supply chain purchases, but strictly obeys dynamic Budget Cap Guardrails and enforces Human-in-the-Loop (HITL) PayPal settlements.
โ๏ธ What it does
Restock.ai is an end-to-end autonomous B2B inventory procurement platform.
- Autonomous Monitoring & Sourcing: The system tracks inventory against custom thresholds. When a deficit is detected (e.g., dropping below 15 bags of coffee beans), it wakes up our autonomous Researcher Agent.
- Smart Trade-off Analysis: Using Gemini 2.5 Flash, the agent queries supplier catalogs and calculates a multi-attribute heuristic score balancing price (50%), lead time (30%), and vendor rating (20%), while aggressively scanning for wholesale Economic Order Quantity (EOQ) bulk discounts.
- AG Grid Data Visualization: Instead of hiding the AI's logic, Restock.ai presents live supplier quotes on a high-performance AG Grid dashboard, clearly showing the AI's top pick alongside market benchmarks.
- Zero-Trust Financial Execution: To ensure safety, we enforce strict Budget Caps. If an order exceeds the cap (or if set to a strict $0 limit), the AI pauses and requests human approval. Once the owner clicks "Approve & Pay", our Execution Agent securely processes the transaction via the PayPal Orders API v2.
- Automated Reconciliation: Upon successful PayPal settlement, stock levels are instantly replenished and a cryptographically verifiable PDF receipt is dynamically generated.
๐ ๏ธ How we built it
We engineered a robust full-stack architecture separated into two main domains:
- The Brains (Backend): We used Python and FastAPI to build a highly concurrent multi-agent system, leveraging the Model Context Protocol (MCP) to give our Gemini 2.5 Flash agents secure access to live supplier data and external tool execution. PDF receipts are generated on the fly using ReportLab. The backend is deployed on Render.
- The Face (Frontend): We built a highly responsive, multi-tenant UI using React 19, TypeScript, Vite, and Tailwind CSS, deployed on Vercel. We deeply integrated AG Grid to handle complex supplier comparisons and sorting.
- The Settlement (Payments): We integrated the official PayPal JavaScript SDK and Orders API v2. The frontend securely communicates with our FastAPI backend to authorize the payload, capture the funds via PayPal Sandbox, and finalize the financial state.
โ ๏ธ Challenges we ran into
Our biggest challenge was solving the "black box" problem of AI agents. If an AI is about to spend $500 via PayPal, the business owner needs to know why. We had to figure out how to stream the agent's internal thought process to the frontend in real-time. We solved this by building the "Agent Terminal"โa live log that visually prints the MCP queries and Gemini reasoning steps before handing off the final payload to the PayPal Smart Buttons.
๐ Accomplishments that we're proud of
We successfully bridged the gap between theoretical AI agents and actual financial settlement. Getting an LLM to recommend a product is easy; getting a multi-agent system to securely prep a payload, pass it to PayPal, await human authorization, capture the funds, and generate an official receipt without breaking state is an accomplishment we are incredibly proud of.
๐ What we learned
We learned the immense power of combining structured data grids (AG Grid) with unstructured AI reasoning. We also learned how to properly sandbox autonomous financial agents using strict threshold logic to make Agentic Commerce safe for non-technical users.
๐ What's next for Restock.ai
We plan to expand our MCP toolsets to directly integrate with major ERP systems like SAP and NetSuite and build SMS-based Human-in-the-Loop approvals so business owners can authorize PayPal restock transactions directly from a text message while on the go.
Built With
- ag-grid
- agentic-commerce
- artificial-intelligence
- fastapi
- gemini-2.5-flash
- mcp
- model-context-protocol
- paypal
- python
- react
- render
- reportlab
- tailwind-css
- typescript
- vercel
- vite