Skip to content
anshulrawat2507Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Smart-Cart Upsell & Negotiation Agent

Razorpay AI Buildathon — Track 1 & AI Risk Track
A deterministic, auditable FinTech AI agent with zero LLM hallucinations in pricing, complete with a React/Vite Storefront and Razorpay Webhook integration.


Architecture

┌─────────────────┐    chat      ┌──────────────────────────────────────┐
│  React / Vite   │ ───────────► │           FastAPI Backend            │
│  (Storefront)   │ ◄─────────── │                                      │
└─────────────────┘  pay link    │  ┌──────────┐   ┌─────────────────┐ │
                                 │  │  Groq    │   │  Financial Core │ │
                                 │  │ LLM Agent│──►│  (guardrails)   │ │
                                 │  │ (router) │   └────────┬────────┘ │
                                 │  └──────────┘            │          │
                                 │                          ▼          │
                                 │  ┌──────────┐   ┌─────────────────┐ │
                                 │  │ Supabase │◄──│   Razorpay API  │ │
                                 │  │ (DB+Audit│──►│  (Payment link) │ │
                                 │  └──────────┘   └─────────────────┘ │
                                 └──────────────────────────────────────┘

Key Features:

  • Zero LLM Math: The LLM only emits JSON tool-calls. It never calculates prices or generates links.
  • Razorpay Webhooks: Automatically catches payment.captured events to close the payment loop.
  • Inventory Control: Deducts stock on successful payment and prevents the AI from selling out-of-stock items (Graceful Failure).
  • Competitor Scraper Recovery: If the external DuckDuckGo price scraper fails, the backend catches the timeout and instructs the LLM to gracefully pivot the conversation without crashing.
  • Admin Dashboard: Brutalist admin portal to monitor live revenue, sessions, and insert new inventory.

Quick Start (For Judges)

1. Database Setup (Supabase)

  1. Go to your Supabase project's SQL Editor.
  2. Run the sql/create_tables.sql script to create the schema.
  3. Run the sql/seed_data.sql script to populate the catalog with test products.

2. Backend Setup (FastAPI)

Open a terminal and navigate to the project root:

# Install dependencies
pip install -r requirements.txt

# Configure environment
cp .env.example .env
# Fill in your keys (Supabase, Groq, Razorpay) in the .env file

# Run the backend
uvicorn backend.main:app --port 8000

3. Frontend Setup (React/Vite)

Open a second terminal and navigate to the web folder:

cd web
npm install
npm run dev

4. Test the App

  • Storefront: Go to http://localhost:5173 to interact with the AI, negotiate a price, and buy a product.
  • Admin Dashboard: Go to http://localhost:5173/admin (Passcode: smartcart2026) to view live revenue, audit logs, and add new inventory.

The "End-to-End" Test Flow

  1. Chat with the agent on the Storefront and ask for a 4K Monitor.
  2. Negotiate a discount.
  3. Click the generated Razorpay link and pay (using test cards).
  4. Go to the Admin Dashboard to watch your revenue increase.
  5. Go back to the chat and ask to buy the same monitor again. The AI will gracefully inform you it is out of stock!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages