Skip to content

AI-powered customer support email automation system built with Langchain & Langgraph

Notifications You must be signed in to change notification settings

wanghaisheng/langgraph-email-automation

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Customer Support Email Automation

I used Langchain/Langgraph to build a customer support email automation system for an AI agency. It consists of multiple AI agents working together to achieve the following steps:

  • Check for new emails in the agency GMAIL inbox.
  • Categorize email into 'customer_complaint', 'product_enquiry', 'customer_feedback', 'unrelated'.
  • Synthesize queries to extract relevant information from RAG to answer customer.
  • Write a draft email to respond to the client.
  • Email verifier: Check the quality and correct formatting of the email, and ensure its relevancy.

System Flowchart

This is the detailed flow of the system:

How to Run

Prerequisites

  • Python 3.7+
  • Groq api key
  • Gmail API credentials
  • Necessary Python libraries (listed in requirements.txt)

Setup

  1. Clone the repository:

    git clone https://github.com/kaymen99/langgraph-email-automation.git
    cd langgraph-email-automation
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  3. Install the required packages:

    pip install -r requirements.txt
  4. Set up environment variables:

    Create a .env file in the root directory of the project and add your GMAIL address, as we are using llama3-70b with Groq you must also get an API key to access it:

    MY_EMAIL=your_email@gmail.com
    GROQ_API_KEY=your_groq_api_key
  5. Ensure Gmail API is enabled:

    Follow this guide to enable Gmail API and obtain your credentials.

Running the Application

  1. Start the workflow:

    python main.py

    The application will start checking for new emails, categorizing them, synthesizing queries, drafting responses, and verifying email quality.

Customization

You 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.

You 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):

python create_index.py

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes.

Contact

If you have any questions or suggestions, feel free to contact me at aymenMir1001@gmail.com.

About

AI-powered customer support email automation system built with Langchain & Langgraph

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 92.3%
  • Python 7.7%