← Back to Projects
LangChainGoogle GeminiDjangoWebSockets

Email Classifier AI-Agent

An AI email-triage agent that classifies incoming mail with Google Gemini, stores only the alerts that matter, and streams them to a live dashboard over WebSockets — zero manual triage, zero polling.

Email Classifier AI-Agent

Overview

Support and ops inboxes are flooded with mixed mail — billing failures, system crashes, sign-in alerts, newsletters, and spam — and the few messages that genuinely need action get buried.

This agent runs a background pipeline that reads each incoming email, classifies it with an LLM, and takes one of two paths: important mail is stored and instantly pushed to a real-time dashboard, while noise is dropped at the classification layer and never persisted.

What I Built

I built it as a decoupled system — a Django + DRF backend with Django Channels for WebSockets, a Google Gemini classifier orchestrated through LangChain, and a React + Vite dashboard. The whole stack comes up with a single docker compose up.

Deterministic AI classification — Google Gemini 2.5 Flash runs at temperature 0.0, so identical emails always get the same decision, priority, and reasoning.
Idempotent pipeline — a ProcessedEmail guard table ensures every message is classified exactly once, even across server restarts.
Real-time dashboard — new alerts are pushed instantly over a WebSocket while the REST API serves historical alerts on load, with no polling.
Priority triage & noise filtering — each alert is tagged HIGH / MEDIUM / LOW with human-readable reasoning, and unimportant mail is discarded before it ever reaches the database.
Graceful fallback — a rule-based keyword classifier takes over if the LLM API is unavailable, keeping the pipeline running.
Source-agnostic core — built to support mock JSON, real Gmail over OAuth, webhooks, or streaming queues without touching the classification logic.
Download CV