An intelligent, AI-powered customer support automation system built with LangChain and LangGraph. Automatically processes, categorizes, prioritizes, and responds to customer complaints with multi-agent workflow orchestration.
- Intelligent Complaint Processing - Automated validation, categorization, and sentiment analysis
- Dynamic Priority Assignment - Smart prioritization based on sentiment, category, and urgency
- Automated Email Responses - Context-aware response generation with policy compliance
- Human Escalation - Automatic escalation for high-priority cases requiring human intervention
- Analytics Dashboard - Real-time metrics, trends, and complaint tracking
- Dual Frontend - Customer complaint submission portal and employee management dashboard
- RESTful API - Complete CRUD operations with FastAPI backend
- Persistent Storage - SQLite database with SQLAlchemy ORM
The system uses a multi-agent workflow powered by LangGraph with the following pipeline:
Validation → Categorization → Sentiment Analysis → Priority Assignment
→ Response Generation → Action Suggestions → Re-evaluation
→ Escalation Decision → Human Review (if needed)
- Validation Agent - Validates complaint legitimacy and completeness
- Categorization Agent - Classifies complaints into predefined categories
- Sentiment Agent - Analyzes emotional tone (positive, negative, neutral)
- Priority Agent - Assigns priority levels (low, medium, high, critical)
- Response Agent - Generates appropriate email responses
- Suggestion Agent - Recommends actionable steps for resolution
- Re-evaluation Agent - Reviews priority based on context
- Escalation Agent - Determines if human intervention is required
Backend:
- Python 3.x
- FastAPI - REST API framework
- LangChain - LLM orchestration
- LangGraph - Multi-agent workflow
- Groq - LLM provider
- SQLAlchemy - ORM
- SQLite - Database
- Pydantic - Data validation
Frontend:
- React - Customer portal
- React - Employee dashboard
- Axios - HTTP client
Customer-Support-Agent/
├── Agent/
│ ├── agents/ # Individual agent implementations
│ ├── memory/ # Conversation memory management
│ ├── policies/ # Business rules and policies
│ ├── schemas/ # Pydantic models
│ ├── utils/ # Helper utilities
│ ├── graph.py # LangGraph workflow definition
│ ├── state.py # State management
│ └── main.py # Agent entry point
├── Backend/
│ ├── api.py # FastAPI routes
│ ├── crud.py # Database operations
│ ├── models.py # SQLAlchemy models
│ ├── schemas.py # Pydantic schemas
│ ├── worker.py # Background worker
│ └── db.py # Database configuration
├── Frontend/
│ ├── customer/ # Customer complaint portal
│ └── employee-dashboard/ # Staff management interface
├── Email/ # Email notification system
└── FinalisingAgent/ # Final processing logic
- Python 3.8+
- Node.js 16+ (for frontend)
- Groq API key
- Clone the repository
git clone https://github.com/MasirJafri1/Customer-Support-Agent.git
cd Customer-Support-Agent- Install Python dependencies
pip install -r requirements.txt- Configure environment variables
Create a .env file:
GROQ_API_KEY=your_groq_api_key
DATABASE_URL=sqlite:///./complaints.db- Initialize the database
python seed_data.py- Start the FastAPI backend
python main_api.py
# or
uvicorn Backend.api:app --reload- Start the background worker
python main_worker.py- Start the frontend (in separate terminals)
# Customer portal
cd Frontend/customer
npm install
npm run dev
# Employee dashboard
cd Frontend/employee-dashboard
npm install
npm run devPOST /complaints- Submit a new complaintGET /complaints- List all complaints (with optional filters)GET /complaints/{id}- Get complaint by IDPATCH /complaints/{id}- Update complaint status/priorityDELETE /complaints/{id}- Delete a complaintGET /complaints/by-email/{email}- Get complaints for a customer
GET /analytics/summary- Overall metrics summaryGET /analytics/status- Breakdown by statusGET /analytics/priority- Breakdown by priorityGET /analytics/trends- Daily complaint trends
- Visit the customer portal
- Enter email, order ID, and complaint details
- System automatically processes and responds
- Receive automated email response
- Access employee dashboard
- View all complaints with filters
- Monitor real-time analytics
- Handle escalated cases requiring human review
Complaints are automatically classified into categories like:
- Product Quality
- Shipping Issues
- Customer Service
- Billing Problems
- Technical Issues
- Low - Minor issues, no immediate action needed
- Medium - Moderate concerns, standard resolution timeline
- High - Significant issues requiring prompt attention
- Critical - Urgent matters with potential escalation
AI-generated responses are:
- Contextually relevant
- Policy-compliant
- Empathetic and professional
- Actionable with clear next steps
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.
Masir Jafri
- Website: masirjafri.in
- GitHub: @MasirJafri1
- LinkedIn: masirjafri