Skip to content

najmdevstudio/User_Sentiment_Analysis_Platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“¦ Sentiment Support AI

A Multi-Agent LLM-Powered Customer Support Engine Built with Spring Boot, LangGraph Architecture & React



🧠 Overview

Sentiment Support AI is a full-stack, enterprise-grade AI-driven customer support engine that:

  • Classifies user sentiment
  • Generates empathetic responses
  • Creates & tracks support tickets
  • Answers ticket queries
  • Routes messages across multiple LLM providers
  • Uses a meta-agent to judge routing correctness
  • Monitors everything via Prometheus + Grafana
  • Stores workflow audits & execution traces in a database

It uses a LangGraph-inspired multi-agent architecture running on Spring Boot, Java 25 virtual threads, and React 19 for the frontend.

This project serves as a real blueprint for building enterprise AI orchestration systems.


Why this project exists

Most AI projects stop at proof-of-concept. This platform is intentionally designed to explore how LLM-driven workflows behave under enterprise constraints such as observability, failure handling, auditability, and long-running service stability using a JVM-first stack commonly found in production systems.


πŸš€ Features

πŸ€– Multi-Agent Workflow (Node-based LangGraph)

Agents implemented as independent nodes:

  • Classifier Agent β†’ Detects sentiment
  • Feedback Agent β†’ Handles complaints, generates tickets
  • Query Agent β†’ Resolves ticket status
  • Meta Agent (Judge) β†’ Evaluates correctness & quality

🧩 Pluggable LLM Provider Router

Supports multiple model providers:

  • OpenAI
  • Anthropic (Claude)
  • DeepSeek
  • Google Gemini
  • Ollama (local LLMs)

Routing strategies:

  • Single provider
  • Weighted routing
  • Majority vote (parallel virtual threads)
  • Fallback routing
  • Provider health monitoring

🎯 High-quality Response Scoring

Per message scoring metrics:

  • Empathy
  • Clarity
  • Accuracy
  • Relevance
  • Routing correctness (meta-agent heuristic + LLM judge)

πŸ›‘οΈ Resilience4j Integration

Each agent node gets:

  • Automatic retries
  • Circuit breaking
  • Timeout mechanisms
  • Fallback execution paths

πŸ“Š Observability & Monitoring

Prometheus metrics visualized in Grafana:

  • Routing success/failure
  • Provider performance
  • Model latency
  • Workflow execution timeline
  • Circuit breaker states
  • Response quality (LLM judge scores)

🧾 Audit Logging (DB-Persisted)

Every workflow run is stored:

  • Workflow-level entry (workflow_execution)
  • Node-by-node execution (workflow_step)
  • Timestamps, sentiment snapshots, agent responses

πŸ–₯️ Frontend

React 19 (Vite) web UI for interacting with the /api/chat endpoint.


πŸ›οΈ Architecture Diagram

                   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                   β”‚      ChatController     β”‚
                   β”‚   POST /api/chat        β”‚
                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                                 β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚ WorkflowGraph   β”‚
                       β”‚ (Orchestrator)  β”‚
                       β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β–Ό                        β–Ό                        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Classifier  β”‚        β”‚FeedbackHandlerβ”‚         β”‚QueryHandler     β”‚
β”‚Node        β”‚        β”‚Node           β”‚         β”‚Node             β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜        β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚                       β”‚                          β”‚
     β–Ό                       β–Ό                          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ClassifierSvcβ”‚     β”‚FeedbackService      β”‚     β”‚QueryService       β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚                         β”‚                         β”‚
     β–Ό                         β–Ό                         β–Ό
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚LLM Router │────────▢│ModelProvider*│◀──────▢│DB Repositories    β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β–²
                              β”‚
                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β”‚Meta Agent     β”‚
                        β”‚LLM-as-a-Judge β”‚
                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“š Project Structure

sentiment-support-ai/
β”œβ”€β”€ langgraph/
β”‚   β”œβ”€β”€ WorkflowGraph.java
β”‚   β”œβ”€β”€ nodes/
β”‚   β”‚    β”œβ”€β”€ ClassifierNode.java
β”‚   β”‚    β”œβ”€β”€ FeedbackHandlerNode.java
β”‚   β”‚    β”œβ”€β”€ QueryHandlerNode.java
β”‚   β”‚    └── Node.java
β”‚   └── model/
β”‚        β”œβ”€β”€ WorkflowState.java
β”‚        β”œβ”€β”€ SentimentType.java
β”‚
β”œβ”€β”€ modules/
β”‚   β”œβ”€β”€ classifier/ClassifierService.java
β”‚   β”œβ”€β”€ feedback/FeedbackService.java
β”‚   β”œβ”€β”€ query/QueryService.java
β”‚   β”œβ”€β”€ scoring/ScoringService.java
β”‚   β”œβ”€β”€ providers/
β”‚   β”‚     β”œβ”€β”€ ModelProvider.java
β”‚   β”‚     β”œβ”€β”€ LlmModelFactory.java
β”‚   β”‚     └── LlmProviderRouter.java
β”‚
β”œβ”€β”€ infrastructure/
β”‚   β”œβ”€β”€ aop/
β”‚   β”‚    β”œβ”€β”€ ExecutionTraceAspect.java
β”‚   β”‚    └── AgentRoutingAspect.java
β”‚   β”œβ”€β”€ metrics/
β”‚   β”‚    β”œβ”€β”€ WorkflowAuditService.java
β”‚   β”‚    └── RoutingMetricsRecorder.java
β”‚   β”œβ”€β”€ config/
β”‚   β”‚    β”œβ”€β”€ SpringAIConfig.java
β”‚   β”‚    β”œβ”€β”€ OpenApiConfig.java
β”‚   β”‚    └── WebConfig.java (CORS)
β”‚   β”œβ”€β”€ persistence/
β”‚        β”œβ”€β”€ TicketJpaRepository.java
β”‚        β”œβ”€β”€ WorkflowExecutionRepository.java
β”‚        └── WorkflowStepRepository.java
β”‚
β”œβ”€β”€ api/
β”‚   β”œβ”€β”€ ChatController.java
β”‚   └── dto/
β”‚        β”œβ”€β”€ ChatRequest.java
β”‚        └── ChatResponse.java
β”‚
β”œβ”€β”€ domain/
β”‚   β”œβ”€β”€ Ticket.java
β”‚   β”œβ”€β”€ WorkflowExecution.java
β”‚   └── WorkflowStep.java
β”‚
└── frontend/ (React 19 application)

βš™οΈ Installation & Setup

1️⃣ Clone the repository

git clone https://github.com/<your-name>/sentiment-support-ai.git
cd sentiment-support-ai

2️⃣ Set environment variables

export OPENAI_API_KEY="your-key"
export ANTHROPIC_API_KEY="your-key"
export DEEPSEEK_API_KEY="your-key"
export GOOGLE_GENAI_API_KEY="your-key"

3️⃣ Configure database

Create PostgreSQL DB:

CREATE DATABASE sentimentdb;
CREATE USER sentiment_user WITH PASSWORD 'sentiment_pass';
GRANT ALL PRIVILEGES ON DATABASE sentimentdb TO sentiment_user;

schema.sql initializes tables automatically.


4️⃣ Start backend

mvn spring-boot:run

5️⃣ Start frontend (React)

cd frontend
npm install
npm run dev

πŸ§ͺ Testing

Run JUnit tests:

mvn test

Tests include:

  • Provider routing
  • Majority voting logic
  • Node execution
  • WorkflowGraph route correctness
  • Scoring JSON parsing
  • Meta-agent correctness evaluation

πŸ“‘ API Usage

POST /api/chat

Request:

{
  "message": "I want to know the status of ticket 1234"
}

Response:

{
  "userMessage": "I want to know the status of ticket 1234",
  "sentiment": "QUERY",
  "response": "Your ticket 1234 is currently open.",
  "ticketId": "1234"
}

πŸ“Š Monitoring With Grafana

Metrics exposed at:

/actuator/prometheus

Dashboard includes:

  • Routing success/failure
  • Latency per node
  • Response quality (empathy, clarity, accuracy)
  • Provider performance
  • Sentiment distribution
  • Circuit breaker status
  • Workflow timeline

A ready-to-import Grafana JSON dashboard is included.


πŸ—ΊοΈ Roadmap

πŸ”œ Coming soon

  • Multi-turn conversational memory
  • Escalation Agent (Supervisor node)
  • Cost-aware provider routing
  • RAG support (retrieval augmented generation)
  • Knowledge graph integration (Neo4j)
  • Functional multi-step workflows (LangChain-style chaining)
  • Auto-fine-tuning on collected audit logs

🀝 Contributing

PRs, discussions, and feature suggestions are welcome!


πŸ“œ License

This project is licensed under the MIT License.

About

A Project Showcasing Multi-Agent LLM-powered Customer Support Engine

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages