Quickfix is an enterprise-grade agentic AI platform that intelligently handles customer complaints through multi-step reasoning, persistent memory, and conditional decision-making. Built with Google Gemini AI, FastAPI, and React.js, it automates complaint classification, prioritization, response generation, and actionable recommendations.
- Key Features
- System Architecture
- Technology Stack
- Getting Started
- API Documentation
- Agent Workflow
- Configuration
- Contributing
- License
- Contact
ComplaintAI operates as an autonomous AI agent, not just a simple chatbot:
- Intelligent Classification β Automatically categorizes complaints into relevant departments
- Dynamic Prioritization β Assigns urgency levels (Low/Medium/High) based on context
- Sentiment Analysis β Analyzes customer emotions and tone
- Satisfaction Prediction β Predicts customer satisfaction outcomes
- Professional Response Generation β Drafts empathetic, context-aware response templates
- Solution Suggestions β Recommends specific solutions based on complaint type
- Smart Action Recommendations β Suggests next steps for resolution
- Complaint Matching β Identifies similar past complaints for faster resolution
- Adaptive Re-evaluation β Reassesses urgency after initial response drafting
- Email Notifications β Automated confirmation emails to users and alert emails to admins
- Persistent Memory β Redis-based memory for high-priority complaint tracking
- Database Integration β SQLite database for complaint history and analytics
- Conditional Workflows β Executes different flows based on complaint severity
- Side-Panel Chatbot β Always accessible for real-time help
- Contextual Guidance β Answers questions about complaint workflow and AI decisions
- Gemini-Powered β Leverages Google's advanced language model
- Graceful Fallbacks β Rule-based logic ensures reliability
- Responsive Design β Works seamlessly across devices
- Intuitive Interface β Clean, user-friendly complaint submission flow
- Real-Time Feedback β Instant AI analysis results
- Dashboard View β Admin dashboard for complaint management
- Complaint List β View and track all submitted complaints
- Component Architecture β Modular React components for maintainability
- Professional Styling β Production-ready CSS modules for each component
- Modular Agent System β 11 specialized AI agents for comprehensive complaint handling
- RESTful API β Clean, documented endpoints
- Database Integration β SQLite database with SQLAlchemy ORM
- Redis Memory Store β Fast, persistent memory for agent state
- Error Handling β Comprehensive exception management
- CORS Support β Configured for frontend integration
- Secure Configuration β Environment-based secrets management
- Startup Scripts β Easy initialization and database setup
- Scalable Architecture β Ready for production deployment
customer-complaint-agent/
β
βββ backend/
β βββ app/
β β βββ agents/
β β β βββ action_recommender.py # Action suggestion engine
β β β βββ chat_agent.py # Chatbot conversation handler
β β β βββ classifier.py # Complaint categorization
β β β βββ complaint_matcher.py # Complaint matching logic
β β β βββ gemini_client.py # Gemini API abstraction
β β β βββ orchestrator.py # Main agent coordinator
β β β βββ priority.py # Priority assignment logic
β β β βββ reevaluator.py # Urgency reassessment
β β β βββ responder.py # Response template generation
β β β βββ satisfaction_predictor.py # Customer satisfaction prediction
β β β βββ sentiment_analyzer.py # Sentiment analysis engine
β β β βββ solution_suggester.py # Solution recommendation system
β β βββ api/
β β β βββ chat.py # Chatbot API endpoints
β β β βββ routes.py # Complaint submission endpoints
β β βββ db/
β β β βββ database.py # Database connection & setup
β β β βββ models.py # SQLAlchemy models
β β βββ memory/
β β β βββ redis_store.py # Redis-based memory management
β β βββ models/
β β β βββ complaint.py # Complaint data model
β β βββ schemas/
β β βββ init_.py # Schema initialization
β β βββ complaint.py # Pydantic schemas
β βββ .env
βββ email_services.py # Environment variables
β βββ check_db.py # Database verification script
β βββ complaints.db # SQLite database
β βββ init_db.py # Database initialization
β βββ requirements.txt # Python dependencies
β βββ requirements.lock.txt # Locked dependencies
β βββ start_backend.py # Backend startup script
β
βββ frontend/
β βββ src/
β β βββ components/
β β β βββ ComplaintCard.jsx # AI result display
β β β βββ ComplaintForm.jsx # Complaint submission form
β β β βββ ComplaintList.jsx # List of complaints
β β β βββ Dashboard.jsx # Admin dashboard
β β β βββ Landing.jsx # Landing page component
β β β βββ SideChatBot.jsx # Integrated chat assistant
β β βββ styles/
β β β βββ ComplaintCard.css # Card styling
β β β βββ ComplaintForm.css # Form styling
β β β βββ ComplaintList.css # List styling
β β β βββ Dashboard.css # Dashboard styling
β β β βββ Landing.css # Landing page styling
β β β βββ SideChatBot.css # Chatbot styling
β β βββ api.js # API client configuration
β β βββ App.css # Global app styles
β β βββ App.jsx # Main application component
β β βββ index.css # Base CSS styles
β β βββ main.jsx # React entry point
β βββ .gitignore # Frontend git ignore
β βββ eslint.config.js # ESLint configuration
β βββ index.html # HTML template
β βββ package.json # NPM dependencies
β βββ package-lock.json # NPM lock file
β βββ vite.config.js # Vite configuration
β βββ start_backend.py # Backend startup helper
β
βββ .gitignore # Git ignore rules
βββ README.md # Project documentation
| Technology | Purpose |
|---|---|
| Python 3.10+ | Core programming language |
| FastAPI | High-performance web framework |
| Google Gemini API | Advanced language model |
| Pydantic | Data validation and serialization |
| SQLAlchemy | SQL toolkit and ORM |
| SQLite | Lightweight database |
| Redis | In-memory data store for agent memory |
| SMTP (Gmail) | Email notification service |
| Uvicorn | ASGI server |
| Technology | Purpose |
|---|---|
| React.js | UI component framework |
| Vite | Fast build tool and dev server |
| Axios | HTTP client for API calls |
| CSS Modules | Scoped component styling |
- Google Gemini β Natural language understanding and generation
- Multi-Agent Pipeline β 11 specialized agents working in coordination:
- Orchestrator β Coordinates all agents
- Classifier β Categorizes complaints
- Priority Agent β Assigns urgency levels
- Sentiment Analyzer β Analyzes emotional tone
- Responder β Generates professional responses
- Action Recommender β Suggests next steps
- Solution Suggester β Recommends specific solutions
- Re-evaluator β Reassesses complaint urgency
- Satisfaction Predictor β Predicts customer satisfaction
- Complaint Matcher β Finds similar past complaints
- Chat Agent β Handles conversational queries
- Redis-Based Memory β Persistent state management across sessions
- SQLite Database β Historical data and analytics
- Rule-Based Fallbacks β Ensures reliability when AI is unavailable
- Node.js 16+ and npm
- Python 3.10+
- Redis (optional, for memory store)
- Google Gemini API Key (Get one here)
git clone https://github.com/RiteshKumar2e/customer-complaint-agent.git
cd customer-complaint-agentcd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Initialize the database
python init_db.py
# Create .env file
echo "GEMINI_API_KEY=your_google_gemini_api_key" > .envcd ../frontend
# Install dependencies
npm installcd backend
# Using the startup script
python start_backend.py
# Or manually with uvicorn
uvicorn app.main:app --reloadBackend will be available at: http://localhost:8000
API documentation: http://localhost:8000/docs
cd frontend
npm run devFrontend will be available at: http://localhost:5174
Endpoint: POST /complaint
Request Body:
{
"complaint": "My refund has been delayed for over 2 weeks"
}Response:
{
"category": "Billing",
"priority": "High",
"sentiment": "Negative",
"satisfaction_score": 0.35,
"response": "We sincerely apologize for the delay in processing your refund. We understand how frustrating this must be. Our finance team has been notified and will prioritize your case immediately.",
"action": "Escalate to finance team within 24 hours",
"solution": "Initiate immediate refund processing and provide tracking number"
}Endpoint: POST /agent/chat
Query Parameters:
message(string, required) β User's question
Example:
POST /agent/chat?message=What%20does%20this%20website%20do
Response:
{
"response": "ComplaintAI is an intelligent customer complaint management system that uses AI to automatically categorize, prioritize, and draft responses to customer complaints. It helps businesses handle customer issues more efficiently."
}ComplaintAI uses a multi-stage agent pipeline for intelligent complaint processing:
βββββββββββββββββββββββ
β Complaint Received β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Classify Category β β Classifier Agent
β (Billing, Support, β
β Technical, etc.) β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Analyze Sentiment β β Sentiment Analyzer
β (Positive, Negative,β
β Neutral) β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Assign Priority β β Priority Agent
β (Low/Medium/High) β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Match Similar β β Complaint Matcher
β Complaints β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Draft Response β β Responder Agent
β (Professional, β
β Empathetic) β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Suggest Solutions β β Solution Suggester
β (Specific fixes, β
β workarounds) β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Recommend Actions β β Action Recommender
β (Escalate, Refund, β
β Investigation) β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Predict Satisfactionβ β Satisfaction Predictor
β (Expected outcome) β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Re-evaluate Urgency β β Re-evaluator Agent
β (Adjust priority if β
β needed) β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Store in Database β β SQLite Database
β & Update Memory β Redis Store
β (Track high-priorityβ
β complaints) β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Send Email β β Email Service
β Notifications β (User + Admin)
β (Confirmation + β
β Alert) β
βββββββββββββββββββββββ
Create a .env file in the backend/ directory:
# Google Gemini API Configuration
GEMINI_API_KEY=your_google_gemini_api_key
# Email Configuration (Gmail)
SENDER_EMAIL=[email protected]
SENDER_PASSWORD=your-gmail-app-password
# Database Configuration
DATABASE_URL=sqlite:///./complaints.db
# Redis Configuration (optional)
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0
# Server Configuration (optional)
HOST=0.0.0.0
PORT=8000
# CORS Settings (optional)
ALLOWED_ORIGINS=http://localhost:5174,http://localhost:3000ComplaintAI sends automated email notifications to users and admins. Follow these steps to configure:
- Go to Google Account Security
- Click "2-Step Verification" and enable it
- Complete the verification process
- Visit App Passwords
- Select App: Mail and Device: Windows Computer
- Copy the generated 16-character password (format:
xxxx xxxx xxxx xxxx)
SENDER_EMAIL=[email protected]
SENDER_PASSWORD=xxxx xxxx xxxx xxxxImportant: Use the App Password, NOT your regular Gmail password!
- User Confirmation Email - Sent immediately after complaint submission with AI analysis results
- Admin Alert Email - Notifies admin team about new high-priority complaints
- Professional Templates - HTML-formatted emails with branding and detailed information
"Username and Password not accepted"
- Verify Gmail address is correct
- Generate a NEW app password from Google Account
- Use App Password, not regular password
- Restart backend server
"2-Step Verification not enabled"
- Enable 2FA in Google Account Security settings
- Then generate app password
SMTP Connection Failed
- Check internet connection
- Verify firewall settings
- Try using VPN if corporate network blocks SMTP
Modify agent behavior in backend/app/agents/:
- classifier.py β Add new complaint categories
- priority.py β Adjust priority thresholds
- sentiment_analyzer.py β Customize sentiment detection
- responder.py β Customize response templates
- solution_suggester.py β Add domain-specific solutions
- action_recommender.py β Define action rules
- satisfaction_predictor.py β Adjust satisfaction metrics
# Initialize/reset database
python init_db.py
# Check database contents
python check_db.pyContributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License. See the LICENSE file for details.
MIT License
Copyright (c) 2024 Ritesh Kumar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Ritesh Kumar
- π GitHub: @RiteshKumar2e
- πΌ LinkedIn: Ritesh Kumar
- π§ Email: [email protected]
- π± Phone: +91 6206269895
If you find this project helpful, please consider giving it a star on GitHub! Your support helps others discover this tool.
- Google Gemini team for the powerful AI API
- FastAPI community for excellent documentation
- React and Vite teams for modern development tools
Made with β€οΈ by Ritesh Kumar