Gaykar commited on
Commit
bd1c641
Β·
1 Parent(s): d98fcbb
Files changed (1) hide show
  1. github_readme.md +41 -53
github_readme.md CHANGED
@@ -1,43 +1,59 @@
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
@@ -46,32 +62,4 @@ app/
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
-
 
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
+ ---
6
 
7
+ ## πŸš€ Key Features
8
 
9
+ - **Advanced Learning Implementation**
10
+ Implemented **Semantic Memory**, **Checkpointer Persistence**, and **Functional Interrupts**, enabling the agent to maintain state and handle user feedback reliably.
11
 
12
+ - **Multi-Agent Workflow**
13
+ Specialized agents for:
14
+ - Triage
15
+ - Context Synthesis
16
+ - Email Drafting
17
 
18
+ - **Intelligent Triage**
19
+ Automatically classifies emails, assigns priority, and determines if a reply is required.
20
 
21
+ - **Semantic Memory**
22
+ Uses `langmem` and `PostgresStore` to retrieve past interactions, allowing the agent to remember previous project details.
23
 
24
+ - **Resource Management**
25
+ A dedicated **Token Count Node** ensures large emails (e.g., deployment logs) are summarized before processing to optimize costs.
26
 
27
+ - **Human-in-the-Loop**
28
+ The graph pauses using `interrupt()` to allow users to:
29
+ - Review drafts
30
+ - Approve responses
31
+ - Provide feedback via `Command(resume=...)`
32
 
33
+ - **Scalable Architecture**
34
+ Built with **FastAPI**, **Docker**, and a modular structure for enterprise-grade deployment.
35
 
36
+ ---
37
 
38
+ ## πŸ› οΈ Tech Stack
39
 
40
+ - **Orchestration:** `langgraph` (Functional API), `langchain`
41
+ - **LLM Interface:** `langchain-groq`
42
+ - **Memory & Persistence:**
43
+ - `langmem`
44
+ - `PostgresCheckpoint`
45
+ - `PostgresStore` (Neon/PostgreSQL)
46
+ - **Database ORM:** SQLAlchemy 2.0
47
+ - **Embeddings:** `langchain_huggingface` (DistilBERT)
48
+ - **Backend:** FastAPI + Uvicorn
49
+ - **Configuration:** `pydantic-settings` (.env management)
50
+ - **Authentication:** `google-auth` (Gmail API Integration)
51
 
52
+ ---
53
 
54
+ ## πŸ“‚ Project Structure
 
 
 
 
 
 
 
 
55
 
56
+ ```bash
57
  app/
58
  β”œβ”€β”€ agents/ # Brains: Specialized LLM logic (Triage, Writer, Context)
59
  β”œβ”€β”€ database/ # Data: SQLAlchemy models and Connection Pooling
 
62
  β”œβ”€β”€ state/ # Schema: Pydantic & TypedDict state definitions
63
  β”œβ”€β”€ utils/ # Toolbox: Token counters, Embeddings, and Auth helpers
64
  β”œβ”€β”€ graph.py # Logic: StateGraph construction and compilation
65
+ └── main.py # Entry: FastAPI app and Controller logic