How randomlyclueless/retainai works
RetainAI is a customer-retention platform: users enter or upload customer data, request churn analysis, and review risk, explanations, recommendations, and retention analytics in the dashboard. The documented analysis combines prediction, explanation, and recommendations; the backend persists customer records and exposes customer and statistics APIs. Separate capabilities include the conversational copilot and model monitoring. The README documents the broader agent architecture, but the agent API and several frontend/backend modules were not sampled, so uncertain internal dispatch links are omitted.
Main entry points: Dashboard.jsx Dashboard · agent_api.py Agent API · CustomerService.java Customer operations · retention_workflow.py Retention workflow
Components 28
React product
- Route application
Frontend/my-app/src/App.js - Dashboard
Frontend/my-app/src/pages/Dashboard.jsx - Customer entry
Frontend/my-app/src/components/CustomerForm.jsx - CSV upload UI
Frontend/my-app/src/components/FileUpload.jsx - Retention analytics
Frontend/my-app/src/components/AnalyticsCharts.jsx - AI insights
Frontend/my-app/src/components/AIInsights.jsx - Risk explanation
Frontend/my-app/src/components/AIExplanationCard.jsx - Copilot chat
Frontend/my-app/src/components/AICopilot.jsx - Customer API client
Frontend/my-app/src/api/customerapi.js - Analytics service
Frontend/my-app/src/services/analyticsService.js
Customer API
- Customer endpoints
backend/backend/src/main/java/com/churn/backend/controller/CustomerController.java - CSV endpoint
backend/backend/src/main/java/com/churn/backend/controller/FileUploadController.java - Customer operations
backend/backend/src/main/java/com/churn/backend/service/CustomerService.java - Customer record
backend/backend/src/main/java/com/churn/backend/model/Customer.java - Customer repository
backend/backend/src/main/java/com/churn/backend/repository/CustomerRepository.java
AI analysis
- Agent API
agent/agent_api.py - Retention workflow
agent/workflows/retention_workflow.py - Churn prediction
agent/agents/prediction_agent.py - SHAP explanation
agent/agents/explanation_agent.py - Retention strategy
agent/agents/recommendation_agent.py - Model monitoring
agent/agents/monitoring_agent.py - Copilot agent
agent/agents/copilot_agent.py - Explainability tool
agent/tools/explainability.py - Gemini service
agent/services/gemini_service.py
Conversation state
- Chat memory
agent/memory/chat_memory.py
Other components
- Business user
- MySQL database
- Google Gemini
Connections 31
- Business user → Route application: uses
- Route application → Dashboard: routes
- Dashboard → Customer entry: presents
- Dashboard → CSV upload UI: presents
- Dashboard → Retention analytics: presents
- Dashboard → AI insights: presents
- Dashboard → Risk explanation: presents
- Dashboard → Copilot chat: presents
- Customer entry → Customer API client: requests
- CSV upload UI → CSV endpoint: uploads CSV
- Retention analytics → Analytics service: requests metrics
- AI insights → Customer API client: requests
- Risk explanation → Customer API client: requests
- Copilot chat → Agent API: asks questions
- Customer API client → Customer endpoints: calls REST
- Customer endpoints → Customer operations: delegates
- Customer operations → Customer repository: reads and saves
- Customer repository → MySQL database: persists records
- Customer operations → Customer record: updates fields
- Customer operations → Agent API: posts analysis
- Agent API → Retention workflow: runs analysis
- Retention workflow → Churn prediction: coordinates
- Retention workflow → SHAP explanation: coordinates
- Retention workflow → Retention strategy: coordinates
- Model monitoring → Agent API: provides monitoring
- SHAP explanation → Explainability tool: uses SHAP
- Copilot chat → Agent API: sends prompts
- Agent API → Copilot agent: handles copilot
- Copilot agent → Chat memory: saves and reads
- Copilot agent → Gemini service: requests response
- Gemini service → Google Gemini: generates content