CHAND.

CHAND.
Agentic AIRole: Full-Stack AI Engineer / Sole DeveloperProduction Ready

MailPilot AI

Autonomous Gmail Assistant with LangGraph State Machines, Real-Time Streaming & Human-in-the-Loop Protection

MailPilot AI Architectural Showcase

LangGraph StateGraph

Agent Framework

Gemini 2.0 Flash

LLM Engine

11 Gmail Tools

Autonomous Tools

HITL Guardrails

Safety Layer

System Narrative

Engineering Context & Problem Scope

MailPilot AI is an autonomous email agent that empowers users to search, summarize, triage, draft, and reply to Gmail emails using natural language without opening the standard Gmail client. Built with LangGraph and Google Gemini 2.0, it features an enterprise-grade Human-in-the-Loop (HITL) architecture that automatically pauses execution and awaits user review before performing sensitive actions like sending, replying, or deleting messages. Engineered with a three-tier persistence model combining SqliteSaver for graph execution state and SQLModel for encrypted authentication, MailPilot AI streams reasoning states and tokens in real-time over Server-Sent Events (SSE) into a responsive Next.js 16 and React 19 interface.

Key Business & Engineering Outcomes

  • Built an autonomous Gmail agent using LangGraph and Google Gemini 2.0 with 11 custom tools for email search, summarization, drafting, and triaging.
  • Architected a Human-in-the-Loop (HITL) safety mechanism with SQLite state checkpointing to require manual user approval before sending or deleting emails.
  • Developed a full-stack real-time interface using Next.js 16, Tailwind CSS, and FastAPI SSE streaming for token-by-token response rendering.

Integrated Technologies

LangGraphGoogle Gemini 2.0 FlashFastAPINext.js 16 (App Router)React 19Tailwind CSSSQLModel / SQLiteGoogle OAuth 2.0Gmail REST APIServer-Sent Events (SSE)Python 3.12+TypeScript

Architecture Blueprint

Full-Stack System Layers

Architected for high throughput, data consistency, and robust fault-tolerance.

Frontend Layer

  • Next.js 16 (App Router)
  • React 19 & TypeScript
  • Tailwind CSS with Futuristic Dark Theme
  • Real-Time SSE Token & Reasoning Stream Handler
  • Interactive HITL Approval Cards & Thread Modal

Backend & APIs

  • FastAPI Async Server (Python 3.12+)
  • LangGraph ReAct StateGraph State Machine
  • Custom SSE Streaming Pipeline with Token Deduplication
  • Google OAuth 2.0 Token Lifecycle & Session Manager

Data & Persistence

  • SqliteSaver Checkpointer (Agent State & Thread Snapshots)
  • SQLModel Database (User Profiles & Encrypted Auth Tokens)
  • Client LocalStorage (Multi-Session Short-Term Context)

AI & Vector Layer

  • Google Gemini 2.0 Flash Lite (langchain-google-genai)
  • 11 Autonomous Gmail Tools (Search, Triage, Draft, Send)
  • Human-in-the-Loop Interrupt & Deterministic State Resumption
  • Domain Guardrails & Anti-Hallucination Scope Filters

Capabilities & Features

Core System Features

Key architectural capabilities and modular components engineered for this platform.

Agentic Suite

11 Autonomous Gmail Tools

Comprehensive email tool suite including search_emails, read_email, get_thread, archive_email, mark_as_read/unread, add_label, create_draft, and protected send/reply/delete operations.

Safety Core

Human-in-the-Loop (HITL) Safety Guardrails

Automatically interrupts execution on sensitive/external actions (send, reply, delete), rendering interactive approval cards with full recipient, subject, and body previews before resuming seamlessly from state snapshots.

Persistence

Three-Tier Persistence Architecture

LangGraph SQLite checkpointer (SqliteSaver) preserves graph thread snapshots, SQLModel manages authenticated user profiles and encrypted OAuth tokens, and local cache preserves multi-session history.

Real-Time SSE

Real-Time Token & Reasoning Streaming

Server-Sent Events (SSE) stream model tokens, animated thinking indicators, and deduplicated tool usage metadata live to the client.

Modern UI

Responsive Modern UI & Thread Inspection

Built with Next.js 16 and Tailwind CSS featuring quick-action capability cards, email thread inspection modal (with HTML/plain text view), and off-canvas mobile drawer navigation.

Interested in Building a Similar System?

Let's discuss architecture blueprints, tech stack selection, and production deployment tailored for your requirements.