Agentic AI Marketplace Intelligence Platform for Bharat
Seven specialist agents, a live orchestrator you can watch think, and an explainable Decision Engine β over 500 sellers, 3,000 listings, 5,000 reviews of realistic marketplace data with planted fraud rings the agents genuinely catch.
The UI doesn't poll a finished answer β it subscribes to a Server-Sent Events stream and watches the Orchestrator dispatch each agent, narrate its real computation phases, return its computed score, and hand everything to the Decision Engine for a fused, explainable verdict:
customer intent βββΊ Orchestrator ββ SSE βββΊ browser
β (graph lights up, console types,
βΌ agent cards fill in live)
Seller Monitoring β Authenticity β Fraud β Review Intelligence
β Return Prediction β Price Intelligence β Logistics
β
βΌ
Decision Engine β RECOMMEND / RECOMMEND WITH CAUTION / SUPPRESS
+ six-signal breakdown of WHY
A second stream (/api/events/stream) powers the Admin ops room: fraud
rings, counterfeit listings and return-risk interventions surface as the
agents flag them, plotting onto a live risk map of India.
| Admin ops room | Seller studio |
|---|---|
![]() |
![]() |
| Agent | Technique | Output |
|---|---|---|
| π¨ Fraud Detection | Isolation Forest + GST/phone/IP identity graph (pure-Python robust z-score fallback when compiled DLLs are unavailable) | risk 0β100 + evidence |
| π‘οΈ Seller Monitoring | weighted behavioural scoring (cancellations, delays, complaints, volatility) | trust 0β100 + reasons |
| π·οΈ Authenticity | metadata + price-vs-MRP coherence for premium brands (OCR hook ready) | % authentic + counterfeit prob |
| π¬ Review Intelligence | Jaccard shingle near-duplicate clustering + spam heuristics | % genuine + flagged reviews |
| π¦ Return Prediction | interpretable logistic model over category/seller/price features | probability + intervention |
| πΈ Price Intelligence | category quantiles (p25/median/p75) + elasticity | recommended price |
| π Logistics | haversine routing across a 5-hub network vs central baseline | warehouse, ETA, βΉ savings |
| π£οΈ Support | intent routing + DB-backed actions in 11 Indian languages | grounded replies |
| βοΈ Trust Engine | weighted fusion of six signals | overall score + band |
The proof it's real: the seed plants a 3-seller ring sharing one phone number and IP, plus premium-brand listings at 26β33% of MRP. The agents are never told who's bad β they find them (ring flagged at 84β96 risk via the identity graph; counterfeits at 44% authenticity via price coherence). The CI suite asserts exactly this on every push, on both the full-ML and pure-Python backends.
Windows: double-click setup.bat, then run.bat β opens http://localhost:8000
macOS / Linux:
./setup.sh && ./run.sh # dashboard at http://localhost:8000, API docs at /docsManual:
cd backend
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python -m app.seed # 500 sellers / 3,000 products / planted anomalies
uvicorn app.main:app --port 8000Demo flow that lands hardest: click the Adidas pick with the red dot (planted counterfeit) and watch the Authenticity agent catch it live, then open Admin Ops to see the fraud ring surface in the event stream.
npm i -g vercel && vercel # from the repo root β that's itor import the GitHub repo at vercel.com/new β no configuration needed. The repo is Vercel-native:
public/β static frontend, served from the edgeapi/index.pyβ the FastAPI app as a serverless function (vercel.jsonrewrites/api/*,/docs,/healthto it)data/bharattrust.seed.dbβ pre-seeded snapshot copied to/tmpon cold start (serverless filesystems are read-only)- root
requirements.txtis deliberately slim β no scikit-learn/scipy β so the bundle stays small; the fraud agent auto-degrades to its pure-Python backend with identical interfaces (CI tests this exact path)
Streaming note: SSE pacing is guaranteed on local/Render/Railway runs. Some Vercel plans buffer Python responses; if so, frames arrive together at stream end and the UI still renders everything β just less theatrically. For judged demos, run locally or on Render.
render.yaml blueprint and backend/Procfile are included:
web: uvicorn app.main:app --host 0.0.0.0 --port $PORT
Set one env var β the schema creates itself on startup:
DATABASE_URL=postgresql+psycopg://user:pass@host:5432/postgres
| Method | Path | Description |
|---|---|---|
| GET | /api/orchestrate/picks |
interesting listings (incl. planted counterfeits) |
| GET | /api/orchestrate/stream?product_id= |
SSE β live agent-by-agent evaluation |
| GET | /api/events/stream |
SSE β live marketplace ops feed |
| GET | /api/analytics/overview |
KPIs + marketplace health |
| GET | /api/fraud/scan?min_risk=50 |
fraud scan with evidence |
| GET | /api/sellers/{id}/trust |
full orchestrated trust evaluation |
| POST | /api/returns/predict |
pre-shipment return probability |
| POST | /api/price/recommend |
optimal price recommendation |
| POST | /api/logistics/optimize |
warehouse + route + savings |
| POST | /api/support/ask |
multilingual support agent |
Interactive docs at /docs.
βββ api/index.py Vercel serverless entrypoint
βββ backend/
β βββ app/
β β βββ agents/ the nine agents + trust engine + orchestrator
β β βββ orchestration/ SSE frame generators (live.py, events.py)
β β βββ routers/ REST (api.py) + streaming (stream.py)
β β βββ models.py Β· seed.py Β· main.py Β· database.py
β βββ requirements.txt full stack (Isolation Forest) for local/Render
βββ public/index.html the entire frontend β zero JS dependencies
βββ data/bharattrust.seed.db pre-seeded snapshot for serverless deploys
βββ tests/test_smoke.py proves planted anomalies are genuinely caught
βββ .github/workflows/ci.yml two jobs: full-ML and pure-Python paths
βββ vercel.json Β· render.yaml Β· setup/run scripts
Every score is computed at request time from the database β but these are
algorithmic agents (statistics, one ML model, graph analysis, heuristics),
not LLM agents. The console's reasoning lines are honest narrations of each
agent's real computation phases, paced for legibility; no language model
"thinks" in the loop. That mirrors how production marketplace-integrity
systems actually work. Documented hooks for the natural next milestones:
Mistral-generated decision rationales, OCR-backed packaging verification
(ocr_text param wired), real translation services, production auth.
Windows: DLL load failed β¦ An Application Control policy has blocked this file β
Smart App Control blocks scipy's unsigned DLLs. Handled automatically: the
fraud agent detects the blocked import and switches to its pure-Python
backend (same interface, same planted-ring detection). No need to touch
Windows security.
ERR_CONNECTION_REFUSED β the server didn't start; scroll the run.bat
console up for the actual Python error.
MIT β see LICENSE.

