Skip to content

vinsblack/commerce-ai-agent

Repository files navigation

CommerceAI Agent

Autonomous AI agents for e-commerce automation — built on the Model Context Protocol (MCP)

Python React MCP License Docker

CommerceAI Agent is a multi-agent system that automates e-commerce operations using specialized AI agents. Each agent handles a specific domain — inventory, pricing, customer service, marketing — and communicates through the Model Context Protocol (MCP) for seamless LLM integration.


How It Works

The system deploys specialized agents that autonomously manage different aspects of an online store:

                    ┌─────────────────────┐
                    │    MCP Protocol     │
                    │  (LLM Integration)  │
                    └────────┬────────────┘
                             │
            ┌────────────────┼────────────────┐
            │                │                │
   ┌────────▼──────┐ ┌──────▼───────┐ ┌──────▼───────┐
   │   Inventory   │ │   Pricing    │ │  Marketing   │
   │    Agent      │ │    Agent     │ │    Agent     │
   │               │ │              │ │              │
   │ - Stock mgmt  │ │ - Dynamic    │ │ - Product    │
   │ - Demand      │ │   pricing    │ │   copywriting│
   │   forecasting │ │ - Competitor │ │ - SEO        │
   │ - Auto-reorder│ │   analysis   │ │ - Campaigns  │
   └───────────────┘ └──────────────┘ └──────────────┘
            │                │                │
   ┌────────▼──────┐ ┌──────▼───────┐        │
   │   Customer    │ │    Email     │        │
   │   Service     │ │    Agent     │        │
   │    Agent      │ │              │        │
   │               │ │ - Auto-reply │        │
   │ - Chat bot    │ │ - Follow-ups │        │
   │ - Returns     │ │ - Newsletters│        │
   │ - Complaints  │ │ - Refunds    │        │
   └───────────────┘ └──────────────┘────────┘
                             │
                    ┌────────▼────────────┐
                    │   FastAPI Backend   │
                    │   PostgreSQL + Redis│
                    └─────────────────────┘

Agents

Inventory Agent

Monitors stock levels across connected stores, forecasts demand based on historical sales data, and triggers automatic reorder suggestions when inventory drops below configurable thresholds.

Pricing Agent

Analyzes competitor pricing, market demand, and margin targets to recommend or automatically adjust product prices. Supports rule-based and ML-driven pricing strategies.

Customer Service Agent

Handles incoming customer queries via chat with context-aware responses. Manages returns, refund requests, and complaint escalation. Learns from previous interactions to improve response quality.

Marketing Agent

Generates optimized product descriptions, SEO metadata, and ad copy. Creates email campaign content and suggests promotional strategies based on inventory levels and sales trends.

Email Agent

Automates transactional and marketing email workflows: order confirmations, shipping updates, review requests, abandoned cart recovery, and personalized newsletters.


Integrations

Category Services
Marketplaces Shopify, WooCommerce, Amazon, eBay
Payments Stripe, PayPal
CRM HubSpot, Salesforce
Shipping DHL, UPS, FedEx
AI OpenAI, Google Cloud AI

Quick Start

Prerequisites

  • Python 3.9+
  • Node.js 16+
  • Docker and Docker Compose
  • PostgreSQL
  • Redis

Installation

git clone https://github.com/vinsblack/commerce-ai-agent.git
cd commerce-ai-agent

# Backend
python -m venv venv
source venv/bin/activate    # Windows: venv\Scripts\activate
pip install -r requirements.txt

cp .env.example .env        # Configure your API keys
python -m src.db.init_db

uvicorn src.main:app --reload
# Frontend
cd frontend
npm install
npm start

Docker Deployment

docker-compose up -d
docker-compose ps
docker-compose logs -f

The dashboard is available at http://localhost:3000, API at http://localhost:8000.


Configuration

Copy .env.example to .env and configure:

# Required
OPENAI_API_KEY=sk-...

# Marketplace integrations (configure as needed)
SHOPIFY_API_KEY=...
SHOPIFY_API_SECRET=...
WOOCOMMERCE_CONSUMER_KEY=...
AMAZON_MWS_ACCESS_KEY=...

# Payments
STRIPE_API_KEY=...
PAYPAL_CLIENT_ID=...

# Database
DATABASE_URL=postgresql://user:pass@localhost:5432/commerce_ai
REDIS_URL=redis://localhost:6379/0

All integrations are configured through the Settings > API page in the dashboard.


Project Structure

commerce-ai-agent/
├── docs/                   # Documentation
├── frontend/               # React frontend
│   ├── public/
│   └── src/
│       ├── components/     # Reusable UI components
│       ├── contexts/       # React Context API
│       ├── pages/          # Application pages
│       └── utils/          # Helpers and utilities
├── src/                    # Python backend
│   ├── api/                # FastAPI endpoints
│   ├── db/                 # Database models
│   ├── mcp/                # MCP protocol implementation
│   ├── schemas/            # Pydantic schemas
│   ├── tasks/              # Async task queue (Celery)
│   └── utils/              # Helpers
├── tests/                  # Unit and integration tests
├── docker-compose.yml
├── requirements.txt
└── setup.sh / setup.bat

Dashboard

The web dashboard provides:

  • Overview — Sales metrics, top products, recent orders, agent activity
  • Products — Catalog management, marketplace sync, AI-powered price optimization
  • Orders — Order processing, status tracking, invoice generation
  • Customers — Purchase history, segmentation, communication preferences
  • Stores — Multi-store management across platforms
  • Agents — Configure, monitor, and control each AI agent
  • Integrations — Manage API connections to external services

Use Cases

  • Solo sellers managing multiple marketplace listings across Shopify, Amazon, and eBay
  • Small e-commerce teams looking to automate repetitive customer service and inventory tasks
  • Agencies managing multiple client stores from a single dashboard
  • Developers building custom e-commerce automation workflows using the MCP protocol

Roadmap

  • Additional marketplace integrations (Etsy, Walmart)
  • Mobile companion app (iOS, Android)
  • SEO optimization agent
  • ERP integration (SAP, Oracle)
  • Multi-language agent support
  • Agent marketplace for community-built automations
  • Analytics and reporting agent

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Commit changes using conventional commits: git commit -m 'feat: add feature'
  4. Push: git push origin feature/your-feature
  5. Open a Pull Request

Please follow PEP 8 for Python and use TypeScript for frontend code. Include tests for new features.


License

  • Community Edition: MIT License
  • Commercial Edition: Contact for licensing

Contact

Vincenzo Gallo — Full Stack Developer & Data Analyst

About

Multi-agent AI system for e-commerce automation — inventory, pricing, customer service, and marketing agents powered by MCP (Model Context Protocol). Built with FastAPI + React.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors