{"id":21361100,"url":"https://github.com/kaymen99/langgraph-email-automation","last_synced_at":"2026-03-07T08:33:24.451Z","repository":{"id":243689944,"uuid":"813154710","full_name":"kaymen99/langgraph-email-automation","owner":"kaymen99","description":"Multi AI agents for customer support email automation built with Langchain \u0026 Langgraph","archived":false,"fork":false,"pushed_at":"2025-02-13T15:31:40.000Z","size":329,"stargazers_count":221,"open_issues_count":2,"forks_count":58,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-26T14:55:21.189Z","etag":null,"topics":["ai-agents","ai-automation","ai-customer-service","ai-customer-support","customer-support","customer-support-automation","email-automation","gmail-api","langchain","langgraph","llama3","rag","rag-agents","rag-application"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaymen99.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-06-10T15:16:03.000Z","updated_at":"2026-01-25T07:26:42.000Z","dependencies_parsed_at":"2024-06-10T17:50:32.962Z","dependency_job_id":"6a2ebe84-9661-45da-8f81-61963ddd96d2","html_url":"https://github.com/kaymen99/langgraph-email-automation","commit_stats":{"total_commits":6,"total_committers":2,"mean_commits":3.0,"dds":"0.16666666666666663","last_synced_commit":"7737bf13af214ed4f1d5eea066ef8332edcc102f"},"previous_names":["kaymen99/langgraph-email-automation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kaymen99/langgraph-email-automation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaymen99%2Flanggraph-email-automation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaymen99%2Flanggraph-email-automation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaymen99%2Flanggraph-email-automation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaymen99%2Flanggraph-email-automation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaymen99","download_url":"https://codeload.github.com/kaymen99/langgraph-email-automation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaymen99%2Flanggraph-email-automation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30209942,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T05:23:27.321Z","status":"ssl_error","status_checked_at":"2026-03-07T05:00:17.256Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agents","ai-automation","ai-customer-service","ai-customer-support","customer-support","customer-support-automation","email-automation","gmail-api","langchain","langgraph","llama3","rag","rag-agents","rag-application"],"created_at":"2024-11-22T06:08:34.525Z","updated_at":"2026-03-07T08:33:24.431Z","avatar_url":"https://github.com/kaymen99.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003c!--\nTitle: Customer Support Email Automation System | Langchain/Langgraph Integration\nDescription: Automate customer support emails with our system built using Langchain/Langgraph. Features include email categorization, query synthesis, draft email creation, and email verification.\nKeywords: Customer support automation, email automation, Langchain, Langgraph, AI email agents, Gmail API, Python email automation, email categorization, email verification, AI agents, AI tools\nAuthor: kaymen99\n--\u003e\n\n# 🚀 **Customer Support Email Automation with AI Agents and RAG**\n\n## 📩 **FULL TUTORIAL: Build AI-Powered Email Automation Using AI Agents + RAG!** 👉 [Read Now](https://dev.to/kaymen99/boost-customer-support-ai-agents-langgraph-and-rag-for-email-automation-21hj) 🎯   \n\n![customer-support-ai-automation](https://github.com/user-attachments/assets/eb061276-0579-4e28-9360-482c8da33a9d)\n\n## **Introduction**  \n\nIn today's **fast-paced environment**, customers demand **quick, accurate, and personalized responses**—expectations that can overwhelm traditional support teams. Managing large volumes of emails, categorizing them, crafting appropriate replies, and ensuring quality consumes **significant time and resources**, often leading to **delays or errors**, which can harm customer satisfaction.  \n\n**Customer Support Email Automation** is an **AI solution** designed to enhance **customer communication** for businesses. Leveraging a **Langgraph-driven workflow**, multiple **AI agents** collaborate to efficiently manage, categorize, and respond to customer emails. The system also implements **RAG (Retrieval-Augmented Generation)** technology to deliver **accurate responses** to any business or product-related questions.  \n\n## **Features**  \n\n### **Email Inbox Management with AI Agents**  \n\n- **Continuously monitors** the agency's Gmail inbox  \n- **Categorizes emails** into '**customer complaint**,' '**product inquiry**,' '**customer feedback**,' or '**unrelated**'  \n- **Automatically handles irrelevant emails** to maintain efficiency  \n\n### **AI Response Generation**  \n\n- **Quickly drafts emails** for customer complaints and feedback using **Langgraph**  \n- Utilizes **RAG techniques** to answer **product/service-related questions** accurately  \n- **Creates personalized email content** tailored to each customer's needs  \n\n### **Quality Assurance with AI**  \n\n- **Automatically checks** email **quality, formatting, and relevance**  \n- **Ensures every response** meets high standards before reaching the client  \n\n## **How It Works**  \n\n1. **Email Monitoring**: The system **constantly checks** for new emails in the agency's Gmail inbox using the **Gmail API**.  \n2. **Email Categorization**: **AI agents** sort each email into **predefined categories**.  \n3. **Response Generation**:   \n   - **For complaints or feedback**: The system **quickly drafts** a tailored email response.  \n   - **For service/product questions**: The system uses **RAG** to retrieve **accurate information** from agency documents and generates a response.  \n4. **Quality Assurance**: Each draft email undergoes **AI quality and formatting checks**.  \n5. **Sending**: **Approved emails** are sent to the client **promptly**, ensuring **timely communication**.  \n\n## System Flowchart\n\nThis is the detailed flow of the system:\n\n[![](https://mermaid.ink/img/pako:eNqllEuP2jAQx7-KZa6AgAB5HFrxFlJBXbarIsIeTDwBi2CntrPAEr57TRIoW_Wwojk585_fvJLxCQeCAvZwGIl9sCFSox_9JUfm6fgTwZkWEo0mnfE3NOYrcXgtNFSpfEHd01jlZjTYxfr49Zyr3YuaTgWawt4ohEUqRQt_wCn6LkUASr3eOw5FYpQXTrjagwR6Q3p-j2hYC8neITcWXC_jXriEyDjQFHXv7b1EabEDiXpiF0eEcY1ME0MAuiLBNkV9_6dk2uidNXD9IaQpjyaBRgP-K2HymKKB_3zkegPqUsJTApKBQqEJN-uMCnKQzWLuj0CjTtYCCqXY3XnMM49_pu1n0tA3iUU4A0L_0odZWZ04luINUjTyn4HTD7PIPaamO4Vm8MYUE9z0mIujQjzonMkmlUtKHyMwHzJkUeSVQjcsKy3FFryS4zjFubJnVG-8RnwoByIS0ivVarV7vFvgq9Uf3LKsz-K9a_bV6hG8f80ePoQP_i_78DY69xF8VOBu-BA-v2Z_DF8UOKX08zguY7NW5j-i5sI4XcItsdmNHSyxZ46UyO0SL_nZ-JFEC7M5Afa0TKCMpUjWG-yFJFLmLYmp2ds-I2tJdjdrTDj2TviAvUbLrjYtt2G1XLdVr7XtZhkfjbnqNJyW4zZt17LdpuO0z2X8LoQJUau6rbbt2la7btmWW6s3s3iLTMxLAHq5zCb5dRcIHrI1Pv8GXQeX4g?type=png)](https://mermaid.live/edit#pako:eNqllEuP2jAQx7-KZa6AgAB5HFrxFlJBXbarIsIeTDwBi2CntrPAEr57TRIoW_Wwojk585_fvJLxCQeCAvZwGIl9sCFSox_9JUfm6fgTwZkWEo0mnfE3NOYrcXgtNFSpfEHd01jlZjTYxfr49Zyr3YuaTgWawt4ohEUqRQt_wCn6LkUASr3eOw5FYpQXTrjagwR6Q3p-j2hYC8neITcWXC_jXriEyDjQFHXv7b1EabEDiXpiF0eEcY1ME0MAuiLBNkV9_6dk2uidNXD9IaQpjyaBRgP-K2HymKKB_3zkegPqUsJTApKBQqEJN-uMCnKQzWLuj0CjTtYCCqXY3XnMM49_pu1n0tA3iUU4A0L_0odZWZ04luINUjTyn4HTD7PIPaamO4Vm8MYUE9z0mIujQjzonMkmlUtKHyMwHzJkUeSVQjcsKy3FFryS4zjFubJnVG-8RnwoByIS0ivVarV7vFvgq9Uf3LKsz-K9a_bV6hG8f80ePoQP_i_78DY69xF8VOBu-BA-v2Z_DF8UOKX08zguY7NW5j-i5sI4XcItsdmNHSyxZ46UyO0SL_nZ-JFEC7M5Afa0TKCMpUjWG-yFJFLmLYmp2ds-I2tJdjdrTDj2TviAvUbLrjYtt2G1XLdVr7XtZhkfjbnqNJyW4zZt17LdpuO0z2X8LoQJUau6rbbt2la7btmWW6s3s3iLTMxLAHq5zCb5dRcIHrI1Pv8GXQeX4g)\n\n## Tech Stack\n\n* Langchain \u0026 Langgraph: for developing AI agents workflow.\n* Langserve: simplify API development \u0026 deployment (using FastAPI).\n* Groq and Gemini APIs: for LLMs access.\n* Google Gmail API\n\n## How to Run\n\n### Prerequisites\n\n- Python 3.7+\n- Groq api key\n- Google Gemini api key (for embeddings)\n- Gmail API credentials\n- Necessary Python libraries (listed in `requirements.txt`)\n\n### Setup\n\n1. **Clone the repository:**\n\n   ```sh\n   git clone https://github.com/kaymen99/langgraph-email-automation.git\n   cd langgraph-email-automation\n   ```\n\n2. **Create and activate a virtual environment:**\n\n   ```sh\n   python -m venv venv\n   source venv/bin/activate  # On Windows use `venv\\Scripts\\activate`\n   ```\n\n3. **Install the required packages:**\n\n   ```sh\n   pip install -r requirements.txt\n   ```\n\n4. **Set up environment variables:**\n\n   Create a `.env` file in the root directory of the project and add your GMAIL address, we are using the Groq llama-3.1-70b model and the Google gemini embedding model so you must also get API keys to access them:\n\n   ```env\n   MY_EMAIL=your_email@gmail.com\n   GROQ_API_KEY=your_groq_api_key\n   GOOGLE_API_KEY=your_gemini_api_key\n   ```\n\n5. **Ensure Gmail API is enabled:**\n\n   Follow [this guide](https://developers.google.com/gmail/api/quickstart/python) to enable Gmail API and obtain your credentials.\n\n### Running the Application\n\n1. **Start the workflow:**\n\n   ```sh\n   python main.py\n   ```\n\n   The application will start checking for new emails, categorizing them, synthesizing queries, drafting responses, and verifying email quality.\n\n2. **Deploy as API:** you can deploy the workflow as an API using Langserve and FastAPI by running the command below:\n\n   ```sh\n   python deploy_api.py\n   ```\n\n   The workflow api will be running on `localhost:8000`, you can consult the API docs on `/docs` and you can use the langsergve playground (on the route `/playground`) to test it out.\n\n\n### Customization\n\nYou can customize the behavior of each agent by modifying the corresponding methods in the `Nodes` class or the agents prompt `prompts` located in the `src` directory.\n\nYou can also add your own agency data into the `data` folder, then you must create your own vector store by running (update first the data path):\n\n```sh\npython create_index.py\n```\n\n### Contributing\n\nContributions are welcome! Please open an issue or submit a pull request for any changes.\n\n### Contact\n\nIf you have any questions or suggestions, feel free to contact me at `aymenMir1001@gmail.com`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaymen99%2Flanggraph-email-automation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaymen99%2Flanggraph-email-automation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaymen99%2Flanggraph-email-automation/lists"}