Full-StackFeatured

AI Customer Support Platform — Real-Time Chat & RAG System

A production-style customer support platform built with Django Channels, Celery, Redis, and WebSockets for real-time communication, alongside a full RAG (Retrieval-Augmented Generation) pipeline built from scratch so customers can ask an AI model directly about their issue. The system supports 4 distinct roles — Customer, Agent, Admin, and Super Admin — each redirected to its own role-specific interface after login. Super Admin has full system-level access, Admin manages agents and customers within their scope, and agents are connected to customers either manually by an admin or automatically through a Celery-driven background task that monitors real-time agent availability.

Tech Stack

PythonDjangoDjango ChannelsCeleryRedisWebSocketsPostgreSQLRAG PipelineLLM IntegrationReact.jsNext.jsREST APIs

Key Features

  • Role-based authentication and redirection — Customer, Agent, Admin, and Super Admin are routed to separate interfaces immediately after login
  • Super Admin role — full system-level access across all agents, admins, customers, and platform configuration
  • Admin role — scoped access to manage agents and customers, oversee active conversations, and monitor agent performance
  • Agent role — dedicated interface for handling assigned customer conversations in real time
  • Manual agent assignment — admins can manually assign a specific agent to a customer conversation
  • Automated agent assignment — Celery background tasks monitor real-time agent availability and auto-assign the best available agent to a waiting customer
  • Real-time WebSocket chat — instant bi-directional messaging between customers and agents powered by Django Channels consumers and routing
  • RAG-powered AI assistant — customers can ask the AI model directly about their problem and get an instant, context-aware answer before or alongside human agent support
  • Redis-backed channel layer — powers WebSocket group messaging and presence/availability tracking for agents across Django Channels
  • Background task pipeline — Celery workers handle async jobs such as agent availability checks, assignment dispatch, and notification delivery without blocking request-response cycles

Problem Statement

Customer support teams needed a single platform that could route four different types of users (customers, agents, admins, and a super admin) to the right interface, connect customers to available agents without manual bottlenecks, and reduce agent load by letting an AI model answer common questions directly — all while keeping conversations real-time and reliable.

Architecture Overview

Django backend with Django Channels handling WebSocket consumers and routing for real-time chat, backed by Redis as the channel layer for group messaging and presence tracking. Celery workers (with Redis as the broker) run background tasks — monitoring agent availability and handling automated agent-to-customer assignment outside the request/response cycle. A RAG pipeline sits alongside the chat system: customer queries are embedded, relevant context is retrieved, and passed to an LLM to generate grounded answers. Role-based access control determines routing at login, sending each of the 4 roles (Customer, Agent, Admin, Super Admin) to its own scoped interface and API permissions.

Challenges

  • Designing role-based routing and permissions for 4 distinct user types without interface or data bleed between roles
  • Deciding when to assign an agent manually versus automatically, and keeping both paths consistent and race-condition free
  • Tracking real-time agent availability accurately so automated assignment never routes a customer to a busy or offline agent
  • Running assignment and notification logic as background work via Celery without delaying the customer's chat experience
  • Building a RAG pipeline from scratch — ingestion, embeddings, retrieval, and LLM response generation — that stays accurate and relevant to each customer's actual problem

Solutions

  • Implemented role-based middleware and route guards so each role (Customer, Agent, Admin, Super Admin) is redirected to and locked into its own interface and permission scope
  • Built dual assignment paths — a manual admin-triggered assignment and an automatic Celery task — both writing through the same assignment service to avoid conflicting states
  • Used Redis-backed presence tracking through Django Channels so agent online/available status updates in real time and feeds directly into the assignment logic
  • Offloaded agent-matching, notifications, and availability checks to Celery background tasks, keeping the WebSocket chat path fast and non-blocking
  • Built the RAG pipeline end-to-end — document/knowledge ingestion, chunking and embeddings, vector similarity retrieval, and a prompt layer that grounds the LLM response in retrieved context before replying to the customer

Results & Impact

  • Customers are connected to the right support path immediately — either instant AI answers via RAG or a live agent — reducing wait time
  • Automated Celery-driven agent assignment removed the need for admins to manually match every customer to an agent
  • Real-time WebSocket chat via Django Channels delivers low-latency messaging between customers and agents
  • Clear separation across 4 roles gives Super Admin full oversight while keeping Agent and Customer experiences simple and focused
  • RAG-powered assistant handles common customer questions directly, cutting down repetitive load on human agents