Spaces:
Runtime error
Runtime error
chnages
Browse files- github_readme.md +77 -0
- image.png +0 -0
github_readme.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
π§ AI-Driven Email Agent π§
|
| 2 |
+
|
| 3 |
+
A production-grade, multi-agent system built with LangGraph and FastAPI that automates email triage, context retrieval, and drafting. This project demonstrates advanced implementation of Long-term Memory, State Persistence, and Human-in-the-Loop Interrupts using LangGraph's Functional API Command pattern.
|
| 4 |
+
|
| 5 |
+
π Key Features
|
| 6 |
+
|
| 7 |
+
Advanced Learning Implementation: Throughout this project, I successfully implemented Semantic Memory, Checkpointer Persistence, and Functional Interrupts, allowing the agent to maintain state and handle user feedback reliably.
|
| 8 |
+
|
| 9 |
+
Multi-Agent Workflow: Specialized agents for Triage, Context Synthesis, and Email Drafting.
|
| 10 |
+
|
| 11 |
+
Intelligent Triage: Automatically classifies emails, assigns priority, and determines if a reply is required.
|
| 12 |
+
|
| 13 |
+
Semantic Memory: Uses langmem and PostgresStore to retrieve past interactions, ensuring the agent "remembers" previous project details.
|
| 14 |
+
|
| 15 |
+
Resource Management: A dedicated Token Count Node ensures large emails (like deployment logs) are summarized before processing to optimize costs.
|
| 16 |
+
|
| 17 |
+
Human-in-the-Loop: The graph pauses using interrupt() to allow users to review, approve, or provide feedback on drafts via Command(resume=...).
|
| 18 |
+
|
| 19 |
+
Scalable Architecture: Built with FastAPI, Docker, and a modular folder structure for enterprise-level deployment.
|
| 20 |
+
|
| 21 |
+
π οΈ Tech Stack
|
| 22 |
+
|
| 23 |
+
Orchestration: langgraph (Functional API), langchain
|
| 24 |
+
|
| 25 |
+
LLM Interface: langchain-groq
|
| 26 |
+
|
| 27 |
+
Memory & Persistence: langmem, PostgresCheckpoint, PostgresStore (via Neon/PostgreSQL)
|
| 28 |
+
|
| 29 |
+
Database ORM: SQLAlchemy 2.0
|
| 30 |
+
|
| 31 |
+
Embeddings: langchain_huggingface (DistilBERT)
|
| 32 |
+
|
| 33 |
+
Backend: FastAPI + Uvicorn
|
| 34 |
+
|
| 35 |
+
Configuration: pydantic-settings (Type-safe .env management)
|
| 36 |
+
|
| 37 |
+
Authentication: google-auth (Gmail API Integration)
|
| 38 |
+
|
| 39 |
+
π Project Structure
|
| 40 |
+
|
| 41 |
+
app/
|
| 42 |
+
βββ agents/ # Brains: Specialized LLM logic (Triage, Writer, Context)
|
| 43 |
+
βββ database/ # Data: SQLAlchemy models and Connection Pooling
|
| 44 |
+
βββ nodes/ # Workflow: Functional steps of the graph (Safety, Tokens)
|
| 45 |
+
βββ persistance/ # Persistence: Postgres Checkpointer & Memory Store config
|
| 46 |
+
βββ state/ # Schema: Pydantic & TypedDict state definitions
|
| 47 |
+
βββ utils/ # Toolbox: Token counters, Embeddings, and Auth helpers
|
| 48 |
+
βββ graph.py # Logic: StateGraph construction and compilation
|
| 49 |
+
βββ main.py # Entry: FastAPI app and Controller logic
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
π Graph Architecture
|
| 53 |
+
|
| 54 |
+
The system follows a pre-processing pipeline before reaching the agentic loop:
|
| 55 |
+
|
| 56 |
+
Safety Check: Filters out malicious content.
|
| 57 |
+
|
| 58 |
+
Token Check: Routes large bodies to a Summarization Node.
|
| 59 |
+
|
| 60 |
+
Triage: Analyzes intent and priority.
|
| 61 |
+
|
| 62 |
+
Context Retrieval: Queries PostgresStore for relevant past facts.
|
| 63 |
+
|
| 64 |
+
Drafting Agent: Creates a reply based on the full context.
|
| 65 |
+
|
| 66 |
+
Interrupt: Pauses for User Review and feedback.
|
| 67 |
+
|
| 68 |
+
π‘οΈ Integrated Security
|
| 69 |
+
|
| 70 |
+
The safety classification in this agent is informed by my specialized project on threat detection:
|
| 71 |
+
|
| 72 |
+
Hybrid Phishing Detection Model: GitHub Repository
|
| 73 |
+
|
| 74 |
+
π¨βπ» Author
|
| 75 |
+
|
| 76 |
+
Atharva Gaykar AI Engineer | IIIT Nagpur
|
| 77 |
+
|
image.png
ADDED
|