AI-powered customer support agent for e-commerce stores. Automates 80%+ of common support inquiries using LangGraph.
- π Order Status (WISMO) - Real-time order tracking with Shopify integration
- π¦ Returns Processing - Automated return eligibility checks and label generation
- π° Refunds - Policy-based auto-approval with escalation for edge cases
- π Sentiment Analysis - Tone adaptation based on customer mood
- π Smart Escalation - Seamless handoff to human agents when needed
- π Analytics - Track automation rates, response times, and more
# Clone and setup
git clone https://github.com/yourcompany/ecommerce-support-agent.git
cd ecommerce-support-agent
python -m venv venv && source venv/bin/activate
make dev
# Configure
cp .env.example .env
# Edit .env with your API keys
# Start services
make docker-up
make migrate
make runβββββββββββββββ ββββββββββββββββ βββββββββββββββββββ
β Chat Widget ββββββΆβ FastAPI ββββββΆβ LangGraph β
β (React) β β API β β Agent β
βββββββββββββββ ββββββββββββββββ ββββββββββ¬βββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββΌββββββββββββββ
β β β
ββββββΌββββββ ββββββββββββββ βββββββββββββββΌββββββββββββββ
β Postgres β β Redis β β Integrations β
β + Vector β β Cache β β Shopify Β· Gorgias Β· EasyPostβ
ββββββββββββ ββββββββββββββ βββββββββββββββββββββββββββββ
Message β Classify Intent β Analyze Sentiment β Fetch Context
β
βββββββββββββββββββββββββββββββββββΌββββββββββββββββββ
β β β β
ββββββΌβββββ ββββββΌβββββ ββββββΌβββββ ββββββΌβββββ
β WISMO β β Returns β β Refunds β β General β
ββββββ¬βββββ ββββββ¬βββββ ββββββ¬βββββ ββββββ¬βββββ
β β β β
βββββββββββββββββββββββββββββββββββΌββββββββββββββββββ
β
Build Response β Check Escalation β End
ecommerce-support-agent/
βββ src/
β βββ agents/ # LangGraph agents
β β βββ graph.py # Main workflow
β β βββ state.py # State definitions
β β βββ prompts.py # LLM prompts
β β βββ nodes/ # Individual agent nodes
β βββ integrations/ # External service clients
β β βββ shopify.py # Shopify API
β β βββ gorgias.py # Gorgias helpdesk
β β βββ shipping.py # EasyPost/carriers
β βββ api/ # FastAPI application
β β βββ main.py # App entry point
β β βββ routes/ # API endpoints
β β βββ middleware/ # Auth, rate limiting
β βββ models/ # SQLAlchemy models
β βββ config.py # Settings
βββ widget/ # React chat widget
βββ tests/ # Test suite
βββ docs/ # Documentation
βββ alembic/ # Database migrations
βββ scripts/ # Utility scripts
| Variable | Description | Required |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | Yes |
REDIS_URL |
Redis connection string | Yes |
OPENAI_API_KEY |
OpenAI API key | Yes |
LANGCHAIN_API_KEY |
LangSmith API key | No |
SENTRY_DSN |
Sentry error tracking | No |
See .env.example for full list.
Stores are configured with:
- Shopify credentials - API access for orders
- Policies - Returns window, refund limits, etc.
- Brand voice - Customized agent personality
- Knowledge base - FAQ and product info
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/v1/conversations |
Start new conversation |
POST |
/api/v1/conversations/{id}/messages |
Send message |
GET |
/api/v1/conversations/{id} |
Get conversation |
| Endpoint | Source | Purpose |
|---|---|---|
/api/v1/webhooks/shopify/orders |
Shopify | Order updates |
/api/v1/webhooks/gorgias |
Gorgias | Ticket sync |
| Endpoint | Purpose |
|---|---|
/health |
Basic liveness |
/health/ready |
Full readiness |
# Run tests
make test
# Run with coverage
make test-cov
# Lint code
make lint
# Format code
make format
# Create migration
make migrate-new# Install Railway CLI
npm install -g @railway/cli
# Login and deploy
railway login
railway up# Build image
make build
# Run
docker run -p 8000:8000 --env-file .env ecommerce-support-agent- LangSmith - Trace all agent runs
- Sentry - Error tracking
- Grafana - Metrics dashboard
See docs/08-METRICS-AND-MONITORING.md for details.
| Doc | Purpose |
|---|---|
| Architecture | System design |
| Week-by-Week | Development plan |
| Technical Spec | Implementation details |
| API Spec | API documentation |
| Integrations | External services |
| Testing | Test approach |
| Deployment | Production setup |
| Monitoring | Observability |
| Runbook | Operations guide |
| Onboarding | Customer setup |
Private - All rights reserved.