An end-to-end, full-stack Agentic AI Customer Support Platform built with FastAPI, React (TypeScript + Vite + Tailwind CSS), PostgreSQL, and Hybrid RAG.
Instead of static chatbot prompts, the system uses an autonomous Plan-Act-Observe agent loop that reasons about customer requests, calls business tools (order lookup, ticket management, policy retrieval, email generation), and streams real-time responses over Server-Sent Events (SSE).
- Autonomous Agentic Loop: Multi-step reasoning engine (Planner, Tool Executor, Observer) to resolve compound support requests.
- Hybrid RAG Pipeline: Combines dense vector search (FAISS) and sparse lexical search (BM25) with cross-encoder reranking.
- Real-Time Streaming (SSE): Streams markdown responses chunk-by-chunk via Server-Sent Events with client-side rendering and automatic database persistence.
- Dual LLM Provider Support: Unified interface supporting Google Gemini (
gemini-2.5-flash) and Groq (openai/gpt-oss-120b/ open models). - Orders & Support Tickets: Order lookup and tracking information, ticket lifecycle management (open/close/reopen), threaded messages, and AI-assisted replies.
- JWT Auth & Data Isolation: Stateless JWT authentication with strict user-level data isolation across conversations, orders, and tickets.
- Evaluation Suite: Automated Information Retrieval metrics (Hit Rate, Precision@K, MRR) and LLM-as-a-judge agent evaluation.
User (Browser) ──► React SPA (Vite + Tailwind) ──► FastAPI (JWT Auth / Tracing)
│
┌──────────────────────────────────────┼──────────────────────────────────────┐
▼ ▼ ▼
PostgreSQL (DB) AI Agent Loop (Orchestrator) Hybrid RAG Engine
(Users, Orders, Tickets, (Planner ──► Tools ──► Observer) (FAISS + BM25 + Reranker)
Conversations, Messages) │ │
└──────────────────┬───────────────────┘
▼
LLM Provider (Gemini / Groq)
│
SSE Token Stream ──► React UI
| Category | Technologies |
|---|---|
| Frontend | React 19, TypeScript, Vite, Tailwind CSS v4, React Markdown |
| Backend | Python 3.12, FastAPI, Uvicorn, SQLAlchemy 2.0, Alembic, Pydantic v2 |
| Database | PostgreSQL 17 |
| AI / LLM | Google Gemini (gemini-2.5-flash), Groq (gpt-oss-120b / open models) |
| RAG & Search | FAISS, Rank-BM25, Sentence Transformers (all-MiniLM-L6-v2), Cross-Encoder (ms-marco-MiniLM-L-6-v2) |
| Security | JWT (python-jose), Passlib / Bcrypt |
| DevOps & Eval | Docker, Docker Compose, Automated IR Metrics (Hit Rate, Precision, MRR) |
- User Request: User sends a message via the React chat workspace (
POST /ask/stream). - Planning: The AI Planner analyzes the user query, conversation history, and context to select the appropriate tool.
- Execution & Context Update: The tool executes (retrieving order details, ticket info, or knowledge chunks) and updates the shared agent context.
- Observation: The Observer determines whether all parts of the user request are answered (
FINISHorCONTINUE). - Streaming Synthesis: The Response Generator synthesizes the accumulated context into structured Markdown and streams tokens via SSE.
- Knowledge Base: Domain policy documents covering shipping, refunds, warranties, payments, and security (
knowledge_base/NovaCart). - Retrieval Pipeline: Multi-query expansion ➔ Parallel FAISS (dense semantic search) & BM25 (sparse keyword search) ➔ Cross-encoder reranking ➔ Context compression.
knowledge_search: Retrieves store policies, procedures, and FAQs via the Hybrid RAG engine.order_lookup: Retrieves shipment status, tracking codes, and delivery estimates scoped to the authenticated user.ticket_lookup: Retrieves support ticket status, assigned agents, and priority levels.send_email: Compiles order, ticket, or policy context into a structured customer support email.
- Orders: Dedicated user order workspace with demo order seeding and status tracking.
- Tickets: Ticket lifecycle operations (open/close/reopen), message threads, and AI features (
/suggest-reply,/summarize,/classify,/analyze). - Authentication: JWT access tokens with user-isolated queries across all database entities.
ai-support-platform/
├── alembic/ # Database schema migrations
├── app/ # FastAPI backend application
│ ├── agent/ # Agent loop (planner, observer, executor, tools, prompts)
│ ├── api/ # REST & SSE endpoints (auth, orders, tickets, rag, health)
│ ├── auth/ # JWT authentication, security, and dependencies
│ ├── core/ # Configuration, error handlers, and middleware
│ ├── database/ # Database engine and session management
│ ├── llm/ # Gemini & Groq multi-provider interface
│ ├── models/ & schemas/# SQLAlchemy models and Pydantic schemas
│ └── services/ # Domain services (RAG, orders, tickets, memory, AI)
├── evaluation/ # RAG metrics (Hit Rate, Precision, MRR) & LLM evaluation
├── frontend/ # React 19 + TypeScript + Vite SPA
├── knowledge_base/ # NovaCart enterprise policy documents
├── docker-compose.yml # Multi-container orchestration (PostgreSQL + Backend)
└── requirements.txt # Python dependencies
- Python 3.11+, Node.js 18+, PostgreSQL (or Docker)
# Clone repository
git clone https://github.com/PR12-tech/ai-support-platform.git
cd ai-support-platform
# Backend setup
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txtCreate a .env file in the root directory:
DATABASE_URL=postgresql://postgres:password@localhost:5432/ai_support_db
SECRET_KEY=your_jwt_secret_key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
FRONTEND_URL=http://localhost:5173
LLM_PROVIDER=gemini # or "groq"
GEMINI_API_KEY=your_gemini_api_key
GROQ_API_KEY=your_groq_api_key# Apply database migrations
alembic upgrade head
# Frontend setup
cd frontend
npm install
cd ..Start Backend (from root with .venv active):
uvicorn app.main:app --reload --port 8000API documentation available at http://localhost:8000/docs.
Start Frontend (from frontend/ directory):
cd frontend
npm run devApplication available at http://localhost:5173.
Run Retrieval Evaluation:
python -m evaluation.test_evaluationTo run the backend and PostgreSQL database in containers:
docker compose up --build
docker compose exec backend alembic upgrade head(The React frontend runs locally via npm run dev against http://localhost:8000)
- Status: Feature-complete working implementation.
- Current Limitations: In-memory local FAISS index (non-distributed); simulated email delivery service; demo order line-items enriched via metadata service.
- Future Improvements: Cloud vector database integration (Qdrant/pgvector), transactional email provider integration (SES/Resend), and CI/CD deployment pipelines.
Prasad Kadam — Built as an exploration of modern GenAI Engineering, combining Agentic AI, Hybrid RAG, structured SQL workflows, and real-time streaming interfaces.