How kaymen99/langgraph-email-automation works
Project type and purpose
• This is a Python-based AI automation system (no UI frontend) that implements a Langgraph workflow of AI agents to monitor a Gmail inbox, categorize incoming emails, retrieve relevant data via RAG, draft and verify responses, and send them back—all orchestrated as a script (main.py) or a deployable API (deploy_api.py).
File structure
• Top-level scripts:
• main.py – runs the end-to-end workflow
• deploy_api.py – serves the same workflow over FastAPI (Langserve)
• create_index.py – builds a Chroma vector store from files in data/
• Data & Storage:
• data/agency.txt – raw documents for RAG
• db/… – Chroma’s binary index files + chroma.sqlite3 for persistence
• Source code in src/:
• src/graph.py – constructs the Langgraph graph of interconnected nodes (agents)
• src/agents.py, nodes.py, prompts.py, state.py, structure_outputs.py – implement each AI agent’s logic, prompts, state management, and output formatting
• src/tools/GmailTools.py – a wrapper around the Gmail API for fetching/sending mails
• Config & dependencies:
• requirements.txt, .env variables for Gmail credentials, GROQ_API_KEY, GOOGLE_API_KEY
README for additional insights
• Workflow steps: monitor inbox → categorize → RAG retrieval for product answers → draft replies → quality-check → send
• Tech stack: Langchain/Langgraph for orchestration, Groq & Gemini LLM APIs, Gmail API, FastAPI for API endpoints
Detail
• Create_index.py indexing step feeding into the Vector Store.
• Environment/config (API keys) as a sidebar or annotation.