Interactive dashboard to visualize AI agents analyzing e-commerce data in real-time.
- π― Real-time Agent Monitoring - Watch Profit Doctor, Inventory Sentinel, and Strategy Supervisor in action
- π Interactive Charts - Visualize risk distribution and category-wise profit/loss
- π Live Metrics - Track SKUs, profitability, and risk levels
- π Auto-refresh - Data updates every 30 seconds
- π¨ Modern UI - Dark mode with glassmorphism effects
- π€ n8n Automation - Orchestrate agent workflows with scheduled runs, alerts, and human approvals
Backend:
- FastAPI
- Python 3.8+
- Pandas, NumPy
Frontend:
- React 18
- TypeScript
- Vite
- Tailwind CSS
- Chart.js
# Create virtual environment
python -m venv venv
# Activate it (Windows PowerShell)
.\venv\Scripts\Activate.ps1
# Install backend dependencies
pip install -r requirements-api.txtOption A: Using the convenience script
.\start-api.ps1Option B: Manual start
.\venv\Scripts\Activate.ps1
python api.pyThe API will start on http://localhost:8000
- API docs: http://localhost:8000/docs
cd dashboard
npm install
cd ..Option A: Using the convenience script
.\start-dashboard.ps1Option B: Manual start
cd dashboard
npm run devThe dashboard will open at http://localhost:5173
- Start the API - The backend will automatically run the agent pipeline on startup
- Open the Dashboard - View real-time agent metrics and recommendations
- Refresh Data - Click the refresh button to re-run agents
- Explore Insights - Sort recommendations, view charts, and analyze SKU performance
- Total SKUs processed
- Profitable vs Loss-making products
- Critical risk alerts
- Profit Doctor metrics
- Inventory Sentinel risk distribution
- Strategy Supervisor action counts
- Risk level distribution (Doughnut chart)
- Profit/Loss by category (Bar chart)
- Sortable columns
- Color-coded risk levels
- Actionable recommendations per SKU
GET /api/health- Health checkGET /api/agents/status- Get agent execution statusPOST /api/agents/run- Trigger pipeline executionGET /api/metrics/summary- Get metrics summaryGET /api/recommendations- Get all recommendationsGET /api/sku/{sku_id}- Get SKU details
POST /api/n8n/analyze- Trigger analysis from n8n workflowPOST /api/n8n/log-action- Log n8n workflow actionsPOST /api/n8n/workflow-complete- Mark workflow completionGET /api/n8n/logs- Get n8n action logsGET /api/n8n/workflow-history- Get workflow execution history
This project includes n8n workflow automation for production deployments.
- β° Scheduled Execution - Run agents automatically (daily, hourly, etc.)
- π Smart Alerts - Email/Slack notifications for critical issues
- β Human Approval - Approve/reject high-impact actions
- π Audit Logging - Track all automated actions
- π Shopify Integration - Fetch real-time store data (optional)
-
Install n8n
# Docker (recommended) docker run -it --rm -p 5678:5678 n8nio/n8n # Or npm npm install n8n -g n8n start
-
Import Workflow
- Open n8n at http://localhost:5678
- Import
n8n_workflow.json - Configure email/Slack credentials
-
Test
- Execute workflow manually
- Check alerts and logs
π Full Setup Guide: See N8N_SETUP_GUIDE.md
Scheduled Trigger (Daily 9 AM)
β
Fetch Data (Shopify/CSV)
β
Send to FastAPI (/api/n8n/analyze)
β
Agents Analyze (Profit Doctor β Inventory Sentinel β Strategy Supervisor)
β
Route by Risk Level (Critical/Warning/Safe)
β
Send Alerts (Email/Slack)
β
Request Approval (for critical actions)
β
Log Actions (/api/n8n/log-action)
β
Complete (/api/n8n/workflow-complete)
The system now supports bidirectional communication! Users can reply to email recommendations with simple commands, and the system automatically executes the actions.
1. System Analyzes β 2. Email Sent β 3. User Replies β 4. Action Executed
β β β β
AI runs daily "Restock needed?" APPROVE_RESTOCK Shopify updated!
Simply reply to recommendation emails with these keywords:
| Action | Command Format | Example |
|---|---|---|
| Approve Restock | APPROVE_RESTOCK_{SKU} |
APPROVE_RESTOCK_IPH001 |
| Custom Quantity | RESTOCK_{SKU}_{QTY} |
RESTOCK_IPH001_150 |
| Change Price | CHANGE_PRICE_{SKU}_{PRICE} |
CHANGE_PRICE_IPH001_1250 |
| Pause Ads | PAUSE_ADS_{SKU} |
PAUSE_ADS_IPH001 |
| Reject | REJECT_{SKU} |
REJECT_IPH001 |
POST /api/n8n/user-action- Receive user actions from emailsGET /api/user-actions/pending- Get pending user actionsGET /api/user-actions/completed- Get completed actionsGET /api/user-actions/history- Get full action history
Access the actions panel at: http://localhost:5173/actions
Features:
- β View pending actions (awaiting execution)
- β View completed actions with details
- β Real-time updates (auto-refreshes every 30 seconds)
- β Filter by SKU
- β Complete audit trail
# 1. Import new workflow to n8n
# Open n8n β Import from File β Select "User-Response-Handler-Workflow.json"
# 2. Update existing workflow with new email templates
# Copy templates from: EMAIL_TEMPLATES_BIDIRECTIONAL.md
# 3. Activate both workflows in n8n
# Toggle the switch to activate
# 4. Test the system
# See SETUP_GUIDE_BIDIRECTIONAL.md for testing instructionsβ
Email-based approvals - No login required, just reply
β
Automatic execution - System updates Shopify automatically
β
Real-time tracking - Dashboard shows all actions
β
Confirmation emails - Know when actions complete
β
Complete audit trail - Every action logged
β
Time savings - ~20 hours/month automation
- π§ Profit Doctor - Profitability analysis
- π¦ Inventory Sentinel - Stock risk assessment
- π― Strategy Supervisor - Action recommendations
- β° Daily Analysis - Scheduled execution at 9 AM
- π§ Smart Alerts - Email notifications for critical issues
- π User Response Handler - Process email replies (NEW!)
- β Action Execution - Automatic Shopify updates (NEW!)
- π Main Dashboard - Metrics, charts, recommendations
- π― Actions Panel - Pending/completed user actions (NEW!)
- π€ Agent Status - Real-time agent monitoring
- π Analytics - Risk distribution & profit analysis
- ποΈ Shopify - Products, inventory, orders
- π§ Gmail - Email notifications & responses
- π€ LangChain + Groq AI - Intelligent insights
- π Slack - Team notifications (optional)
cd dashboard
npm run buildnpm run previewβββββββββββββββββββ ββββββββββββββββββββ
β React + TS β ββHTTPββΊβ FastAPI Server β
β Dashboard β β (Port 8000) β
β (Port 5173) β ββββββββββββββββββββ
βββββββββββββββββββ β
βΌ
βββββββββββββββββββ
β Agent Pipeline β
β - Profit Doctorβ
β - Inventory β
β - Strategy β
βββββββββββββββββββ
API not connecting:
- Ensure
api.pyis running on port 8000 - Check CORS settings in
api.py
Charts not rendering:
- Clear browser cache
- Check browser console for errors
Dependencies issues:
- Delete
node_modulesand runnpm installagain - For Python, use a virtual environment
MIT