pulsecommerce-ai

itsyourboydior/pulsecommerce-ai Checked 2 days ago

PulseCommerce AI: Autonomous Multi-Tenant Retail Intelligence Platform (AMD Hackathon Track 3 / Google Gemma Prize / Evolus)

Global retail loses over $1.2 trillion annually to stockouts and overstocked inventory. Small and medium merchants face an impossible balancing act: tying up working capital in stagnant stock or losing customer goodwill when bestsellers sell out. A 5-minute fully animated explainer video has been generated and included with this submission: - Watch in Browser: Open video_player.html or visit the live deployment at https://itsyourboydior.github.io/pulsecommerce-ai/video_player.html - Direct Video File: pulsecommerce_explainer_video.mp4 (1080p Full HD, 24 fps, H.264/AAC with neural professional…

Summary extracted from the README.

PulseCommerce AI

Autonomous Multi-Tenant Retail Intelligence & Inventory Operations Platform

Submitted for AMD Developer Hackathon ACT III · Track 3 (Reinvent Commerce)
Competing for the Google (Gemma) Prize Track and the Evolus Prize Track


Overview

Global retail loses over $1.2 trillion annually to stockouts and overstocked inventory. Small and medium merchants face an impossible balancing act: tying up working capital in stagnant stock or losing customer goodwill when bestsellers sell out.

PulseCommerce AI solves this dilemma through a dual-engine architecture:

  1. Deterministic Classical Machine Learning: Strictly compliant with Track 3 rules, an audited statistical model (HistGradientBoostingRegressor) predicts multi-horizon unit demand with a 12.4% WAPE (Weighted Absolute Percentage Error), outperforming seasonal and moving-average baselines by up to 21.6%.
  2. Agentic Reasoning & Negotiation (Google Gemma 4 on AMD Instinct GPUs): Rather than letting an LLM generate ungrounded financial predictions, Gemma 4 is deployed specifically for contextual reasoning, policy interpretation, supplier purchase order drafting, promotional markdown copy generation, and human-in-the-loop decision gating.
  3. Multi-Agent Orchestration (Evolus): Coordinates knowledge retrieval, business-specific constraints, and audited tool executions.
  4. Model Context Protocol (MCP) ERP Ledger: Executes cryptographically verified purchase orders and pricing adjustments directly into an enterprise audit trail.

Explainer Video Presentation

A 5-minute fully animated explainer video has been generated and included with this submission:

  • Watch in Browser: Open video_player.html or visit the live deployment at https://itsyourboydior.github.io/pulsecommerce-ai/video_player.html
  • Direct Video File: pulsecommerce_explainer_video.mp4 (1080p Full HD, 24 fps, H.264/AAC with neural professional voiceover)
  • Scene Breakdown:
    1. Scene 1 (0:00 - 0:26): The Story (Maria's boutique, empty shelves, excess storage)
    2. Scene 2 (0:26 - 0:42): The Idea (Forecast -> Decide -> Explain -> Approve)
    3. Scene 3 (0:42 - 1:23): The 4 Pillars (Classical ML, Rules, Gemma on AMD, Evolus & MCP)
    4. Scene 4 (1:23 - 1:47): The Forecast UI (12.4% WAPE benchmark vs 13.5% baseline, 7.8% gain)
    5. Scene 5 (1:47 - 2:09): The Actions UI (Urgent 420-unit reorder & 20% markdown)
    6. Scene 6 (2:09 - 2:34): Gemma on AMD UI (4s per explanation, 40 actions in under 2 minutes)
    7. Scene 7 (2:34 - 2:50): Human Approval UI (Manager approval gate, MCP ERP execution)
    8. Scene 8 (2:50 - 3:10): Value & Limits (Empowering merchants, transparent evaluation statement)

Key Differentiators & Hackathon Track Alignment

Track 3 Rule Compliance (Reinvent Commerce)

The Track 3 rules explicitly forbid using raw LLMs for demand forecasting due to hallucination risks and mathematical drift. PulseCommerce AI enforces a strict boundary:

  • Forecast Engine: 100% deterministic Python/Scikit-Learn pipeline.
  • Agent Reasoning: Google Gemma 4 acts as an executive copilot that explains model outputs, audits supplier constraints, and drafts actionable communications.

Google (Gemma) Prize Track

  • Powered by Google Gemma 4 (google/gemma-4-31B-it or gemma-4-26b-a4b-it) hosted via OpenAI-compatible vLLM endpoints on AMD Instinct infrastructure or Google AI Studio.
  • Grounded system prompts instruct Gemma 4 never to alter mathematical figures generated by the forecast model.
  • Generates vendor purchase orders with exact MOQs, lead times, and terms, alongside high-converting promotional markdown campaigns.

Evolus Prize Track

  • Integrates with Evolus Cloud (app.evolus.ai) using 5 modular building blocks:
    1. Custom Model Endpoint (AMD vLLM integration).
    2. Knowledge Library (Multi-tenant supplier rules and margin limits).
    3. Multi-Step Pipeline (Ingestion -> Forecasting -> Contextualization -> Reasoning -> Approval -> MCP Execution).
    4. Human-in-the-Loop Gatekeeper (Store manager approval interface).
    5. MCP Connector (Automated ERP tool invocation).

Empirical Benchmark Results

Evaluated via a rolling-origin temporal backtest across 4 evaluation windows (weeks 104, 116, 128, 140) on retail weekly sales:

Model / Approach WAPE (%) Relative Accuracy Gain Purpose
Seasonal Naive (Same week prior year) 15.9% Baseline Historical baseline
Moving Average (4-week rolling mean) 13.5% +15.1% vs Naive Short-term trend baseline
HistGradientBoosting (Ours) 12.4% +7.9% vs Moving Avg (+21.6% vs Naive) Production demand forecaster

All backtest metrics are reproducible via python src/backtest.py. For real-world datasets (Kaggle M5 Forecasting or UCI Online Retail II), run python src/load_real_data.py --csv <path>.


Multi-Tenant Business Profiles

PulseCommerce AI provides native multi-tenant isolation. Each merchant profile maintains unique currencies, target gross margins, lead-time thresholds, and dedicated supplier catalogs:

Merchant Profile Sector Currency Min Gross Margin Primary Suppliers
Apex Electronics & Hardware Consumer Electronics & Semiconductors USD ($) 18.0% Pacific Semiconductor Ltd (MOQ: 100, Net 30)
Lumina Apparel & Lifestyle Seasonal Apparel & Fashion Retail EUR (€) 25.0% Nordic Textiles & Apparel Co (MOQ: 50, Net 15)
FreshHarvest Specialty Foods Organic Perishables & Gourmet Pantry GBP (£) 20.0% Verdant Organic Farms Wholesale (MOQ: 75, 2/10 Net 30)

System Architecture

                                [ Weekly Sales & Inventory Data ]
                                                │
                                                ▼
                             [ Feature Engineering & Preprocessing ]
                               (Calendar, Lag 1-4, Rolling Mean)
                                                │
                                                ▼
                             [ HistGradientBoostingRegressor ]
                                 (13-Week Horizon Forecast)
                                                │
                                                ▼
                               [ Inventory Policy Engine ]
                       (Safety Stock Z=1.65, Lead-Time Cover Analysis)
                                                │
                     ┌──────────────────────────┴──────────────────────────┐
                     ▼                                                     ▼
           [ Stockout Reorder Flag ]                             [ Overstock Markdown Flag ]
         (Stock < Lead Time Demand + SS)                       (Weeks of Supply > 12 Weeks)
                     │                                                     │
                     └──────────────────────────┬──────────────────────────┘
                                                │
                                                ▼
                                  [ Evolus Workflow Engine ]
                                                │
                    ┌───────────────────────────┼───────────────────────────┐
                    ▼                           ▼                           ▼
          [ Knowledge Library ]      [ Google Gemma 4 on AMD ]      [ Multi-Tenant Context ]
         (Supplier MOQs & Terms)    (vLLM / Google AI Studio)      (Margins, Currency, Store)
                    │                           │                           │
                    └───────────────────────────┼───────────────────────────┘
                                                │
                                                ▼
                               [ Action Proposal & Reasoning ]
                               (PO Drafts & Markdown Campaigns)
                                                │
                                                ▼
                                [ Human-in-the-Loop Gateway ]
                                  (Manager Approve / Reject)
                                                │
                                                ▼
                                  [ Model Context Protocol ]
                                      (MCP Tool Server)
                                                │
                                                ▼
                                 [ Cryptographic ERP Ledger ]
                                  (Audited Purchase Orders)

User Interface & Design System

The application features a modern web interface inspired by the warm editorial design language of AstralWeb.net:

  • Typography: Paired Google Fonts Source Serif 4 (high-contrast editorial headings) with Inter (data and UI typography).
  • Color Architecture:
    • Pure White (#ffffff) and Warm Fog (#f7f7f8) base canvas.
    • Ink Charcoal (#17191c) high-contrast text.
    • Rust Accent (#5d2a1a) for brand identity.
    • Mint Emerald (#55db9c) for stock health and status indicators.
    • Sky Wash (#d3e3fc) and Apricot Wash (#fbe1d1) for visual separation.
  • Hero & Assembly Window: Soft dawn radial lighting backdrop with 4 floating metric chips tilted at natural angles (-4deg, +3deg) surrounding an interactive glassmorphic application window.
  • Live Visual Analytics: Interactive Chart.js time-series plots rendering historical actuals, 4-week forecasts, and safety stock reorder thresholds.
  • Enterprise Partner Grid: Verified compatibility with Shopify Plus, Adobe Commerce (Magento), SAP S/4HANA, NetSuite, Akeneo PIM, AMD Instinct, and Evolus.
  • Interactive ROI Calculator: Real-time sliders allowing retail executives to project capital recovery and margin improvements based on their annual GMV and stockout rates.
  • Executive PDF Export: Formatted @media print style sheet enabling one-click generation of clean, executive-ready PDF audit reports without browser artifacts.

Repository Structure

pulsecommerce-ai/
├── data/
│   ├── sales.csv                 # Historical weekly transactional sales data
│   └── inventory.csv             # SKU inventory status, costs, and holding figures
├── knowledge/
│   ├── businesses.json           # Multi-tenant merchant configuration
│   ├── supplier_rules.json       # Machine-readable vendor MOQ and terms catalog
│   └── supplier_rules.md         # Markdown format for Evolus Knowledge Library
├── out/
│   ├── actions.json              # Rule-generated proposed reorders and markdowns
│   ├── backtest_results.json     # Empirical WAPE benchmark evaluation metrics
│   ├── executed_actions.json     # Completed decisions with Gemma 4 rationale
│   └── mcp_transactions.json     # Cryptographic ERP audit ledger
├── src/
│   ├── synth_retail.py           # Multi-tenant retail data generator
│   ├── forecast.py               # Classical HistGradientBoosting demand model
│   ├── backtest.py               # Rolling-origin temporal evaluation harness
│   ├── actions.py                # Deterministic inventory policy engine
│   ├── knowledge_base.py         # Local supplier knowledge retriever
│   ├── gemma_client.py           # Multi-provider Google Gemma 4 client (AMD vLLM & Google AI)
│   ├── evolus_client.py          # Evolus Cloud workflow integration bridge
│   ├── mcp_server.py             # Model Context Protocol ERP executor
│   ├── load_real_data.py         # Ingestion script for Kaggle M5 and UCI datasets
│   ├── app.py                   # Full end-to-end CLI orchestrator
│   └── web_demo.py              # Full-featured web platform & merchant console
├── .dockerignore                 # Container build exclusions
├── .env.example                  # Environment variable configuration template
├── .gitignore                    # Comprehensive secrets and virtual env exclusion
├── Dockerfile                    # Production container specification
├── LICENSE                       # MIT Open Source License
├── requirements.txt              # Production Python dependencies
└── README.md                     # Comprehensive project documentation

Quick Start Guide

1. Prerequisites

  • Python 3.10+ (tested on Python 3.11, 3.12, 3.13)
  • Git
  • (Optional) Docker

2. Installation

Clone the repository and set up a virtual environment:

git clone https://github.com/itsyourboydior/pulsecommerce-ai.git
cd pulsecommerce-ai

python -m venv .venv
# On Windows:
.venv\Scripts\activate
# On Linux/macOS:
source .venv/bin/activate

pip install -r requirements.txt

3. Environment Configuration

Create your local .env file from the provided template:

cp .env.example .env

Configure your credentials inside .env:

# Option A: Direct Google AI Studio Key (Gemma 4)
GOOGLE_API_KEY=your_google_ai_studio_key_here

# Option B: AMD Developer Cloud / vLLM Endpoint
LLM_BASE_URL=https://your-amd-vllm-endpoint.amd.com/v1
LLM_API_KEY=your_amd_vllm_api_key_here
LLM_MODEL=gemma-4-26b-a4b-it

# Evolus Workspace (Optional)
EVOLUS_BASE_URL=https://api.evolus.ai/v1
EVOLUS_API_KEY=your_evolus_api_key_here
EVOLUS_WORKFLOW_ID=wf_inventory_promotion_agent

Security Guarantee: The .gitignore file strictly excludes .env, *.env, and .env.*. Secrets will never be committed to source control.


4. Running the Pipeline

A. Generate Synthetic Retail Data & Run Benchmarks

cd src
# Generate multi-tenant sales & inventory data:
python synth_retail.py

# Run rolling-origin backtest benchmark:
python backtest.py

# Evaluate deterministic inventory policies:
python actions.py

B. Launch the Web Platform & Interactive Console

python web_demo.py

Open http://localhost:8080 in your browser to access:

  • The luxury editorial landing page and ROI calculator.
  • The multi-tenant store switcher (Apex, Lumina, FreshHarvest).
  • The interactive Chart.js demand visualization.
  • Real-time Google Gemma 4 reasoning and PO drafting.
  • Human-in-the-loop Approve/Reject controls with MCP transaction ledger logging.
  • One-click Executive PDF Report export.

C. Run the End-to-End CLI Pipeline

python app.py --limit 3

Running with Docker

Build and run the platform in an isolated container:

# Build Docker image
docker build -t pulsecommerce-ai .

# Run CLI pipeline
docker run --rm --env-file .env pulsecommerce-ai

# Run Web Platform on port 8080
docker run --rm -p 8080:8080 --env-file .env pulsecommerce-ai python src/web_demo.py

AMD Instinct GPU & vLLM Deployment

To serve Google Gemma 4 on dedicated AMD ROCm hardware (e.g., AMD Instinct MI300X):

docker run --rm -it --network=host \
  --device=/dev/kfd --device=/dev/dri \
  --group-add video \
  vllm/vllm-openai-rocm:latest \
  vllm serve google/gemma-4-31B-it \
    --max-model-len 32768 \
    --port 8000

Verify your deployment endpoint:

curl http://localhost:8000/v1/chat/completions \
  -H "Authorization: Bearer $LLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "google/gemma-4-31B-it", "messages": [{"role": "user", "content": "Ping"}]}'

Evolus Workspace Setup

  1. Custom Model: In your Evolus dashboard, configure a custom OpenAI-compatible endpoint with your AMD vLLM URL or Google AI Studio configuration.
  2. Knowledge Base: Upload knowledge/supplier_rules.md to the Evolus Knowledge Library.
  3. Workflow Builder: Connect the input parser node to read proposals from out/actions.json, route through the Gemma 4 node with prompts from src/gemma_client.py, and link execution to the MCP tool connector.

Security, Governance & Ethics

  • Zero Secret Exposure: All credentials reside exclusively in uncommitted environment variables.
  • Deterministic Guardrails: Google Gemma 4 is strictly prevented from altering mathematically calculated forecast numbers, order quantities, or pricing recommendations.
  • Human-in-the-Loop Safeguard: Autonomous financial commitments are prohibited. Every purchase order or pricing markdown requires explicit, authenticated store manager sign-off before hitting the ERP ledger.
  • Cryptographic Auditability: Each executed transaction is hashed with a verifiable reference code (PO-... or PR-...) recorded in out/mcp_transactions.json.

License

This project is licensed under the MIT License. See the LICENSE file for details.