project frontend : https://merchant-shadow-frontend.onrender.com project backend : https://merchant-shadow-backend.onrender.com
"While everyone else is teaching AI to shop, we're teaching AI to protect the store from AI shoppers."
Agentic commerce is here — AI buyer agents will purchase on behalf of users. But for every legitimate AI buyer, there are adversarial agents designed to exploit merchant systems through price manipulation, inventory hoarding, coupon stacking, return fraud, review bombing, and LLM-powered negotiation loops.
SENTRY is a self-play adversarial simulation gym that:
-
Live Arena — Runs a real-time Red Team (attacker) vs Blue Team (defender) battle. Both agents co-evolve across generations. Red agents adapt strategies based on empirical success history; Blue agents synthesize formal defense policies with causal attribution.
-
LLM Negotiation — The
adversarial_negotiationattack vector uses Gemini 1.5 Flash to generate live, unscripted negotiation attempts. Blue Team detects the pattern and circuit-breaks the loop in real-time. -
Vaccination Scanner — Runs all 7 attack vectors against a merchant's config before go-live, produces CVE-style vulnerability IDs (
MAS-2026-XXX), quantifies financial exposure, and creates a Razorpay test-mode order for the remediation budget. -
Generation Benchmark Curve — Headless simulation across 1–30 generations, visualized as a dual-axis chart showing Blue block rate rising and average attack impact falling — measurable improvement you can see.
-
PDF Security Report — Professional audit report with executive summary, CVSS scores, and remediation roadmap.
Frontend (React + Vite)
├── Live Arena → WebSocket stream, LLM chat bubbles, Causal DAG
├── Vaccination → Scan progress, vulnerability cards, Razorpay order card
├── Dashboard → Stats, attack distribution chart, benchmark curve
└── Merchants → CRUD merchant management
Backend (FastAPI + Python)
├── /api/arena → WebSocket battle sessions + benchmark endpoint
├── /api/vaccination → WebSocket scan + PDF download + Razorpay order
├── /api/merchants → CRUD merchant profiles
├── /api/dashboard → Aggregated live stats
│
├── agents/
│ ├── red_team.py → 7 attack strategies, generation evolution
│ ├── blue_team.py → 7 defense policies, causal attribution chains
│ ├── simulation.py → Async self-play gym loop
│ ├── llm_negotiation.py → Gemini 1.5 Flash real-time negotiation
│ └── benchmark.py → Headless G1→G30 benchmark engine
│
└── services/
├── causal_engine.py → Causal DAG builder (BEHAVIOR→DECISION chain)
├── vaccination.py → CVE-catalog vulnerability scanner
├── razorpay_client.py → Razorpay Orders API integration
└── pdf_generator.py → ReportLab security audit PDF
- Python 3.11+
- Node.js 18+
git clone <repo-url>
cd sentry
cp .env.example backend/.env
# Edit backend/.env and add your API keys (see below)cd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000cd frontend
npm install
npm run dev
# Opens at http://localhost:5173Create a backend/.env file (or copy .env.example):
# Gemini API — for real LLM adversarial negotiation
# Free at: https://aistudio.google.com/app/apikey
GEMINI_API_KEY=your_key_here
# Razorpay Test Mode — for real order creation on scan completion
# Free at: https://dashboard.razorpay.com/app/keys (switch to Test mode)
RAZORPAY_KEY_ID=rzp_test_...
RAZORPAY_KEY_SECRET=your_secret_hereBoth keys are optional — the app runs with graceful fallbacks if keys are absent:
- Without
GEMINI_API_KEY: adversarial negotiation uses high-fidelity templates - Without Razorpay keys: vaccination scan returns a correctly-shaped mock order
- Dashboard → Click "Run Benchmark" → Select a merchant, 20 generations → Watch block rate rise from ~72% to ~91%
- Arena → Select "StyleVault Fashion" (highest risk config) → Launch Arena → Wait for
adversarial_negotiationattack → See live LLM chat bubbles appear - Vaccination → Select any merchant → Run Scan → Download PDF report → Note the Razorpay order ID created at scan completion
| ID | Attack | Severity | Base Impact |
|---|---|---|---|
| MAS-2026-001 | Dynamic Pricing Oracle Exploitation | CRITICAL | ₹48,000 |
| MAS-2026-002 | Cart Reservation Without Purchase Verification | CRITICAL | ₹1,25,000 |
| MAS-2026-003 | Coupon Policy Satisfiability Gap | HIGH | ₹22,000 |
| MAS-2026-004 | Return Auto-Approval Threshold Exploit | HIGH | ₹67,000 |
| MAS-2026-005 | Review Authenticity Gap | MEDIUM | ₹18,000 |
| MAS-2026-006 | Support Channel LLM Escalation Loop | MEDIUM | ₹8,500 |
| MAS-2026-007 | Multi-Vector Coordinated Attack Surface | CRITICAL | ₹2,85,000 |
| Layer | Technology |
|---|---|
| Backend | FastAPI, Python 3.11, aiosqlite, asyncio |
| Frontend | React 18, Vite, Chart.js, Vanilla CSS |
| LLM | Google Gemini 1.5 Flash (via google-generativeai) |
| Payments | Razorpay Orders API (test mode) |
| Reports | ReportLab PDF generation |
| Realtime | WebSocket (FastAPI native) |