Skip to content

farouk09/Email-Assistant

Repository files navigation

✉️ LangGraph Email Assistant

A smart, production-ready email assistant built using LangGraph and integrated with Gmail and Google Calendar via Auth0. This assistant is designed to simplify email workflows by:

  • Classifying incoming emails as: (respond, ignore, notify)
  • Drafting responses to emails intelligently
  • Scheduling meetings with context from the conversation
  • Remembering cross-thread context using semantic long-term memory
  • Fully secure with Google OAuth authentication through Auth0
Screenshot 2025-04-27 at 21 00 17

Features

  • ✅ Real-time email classification
  • ✅ Smart response drafting
  • ✅ Meeting scheduling via Google Calendar
  • ✅ Semantic memory for contextual awareness across threads
  • ✅ Can handle user commands like sending emails, retrieving the last sent email, and more
  • 🔜 Future: Episodic and procedural memory integration for even more personalized, adaptive behavior

Example Execution

Below are example images of the email assistant in action:

Screenshot 2025-04-27 at 22 02 57 Screenshot 2025-04-27 at 21 22 59 Screenshot 2025-04-27 at 21 54 05 Screenshot 2025-04-27 at 21 54 53

How It Works

The LangGraph-powered assistant uses a graph-based architecture to manage its workflow. Key components include:

Detect Email Received Node

  • This node is responsible for detecting if the input is related to a received email or a general user request.
  • If it detects a received email, it forwards it to the Triage Router Node.
  • If it detects a simple request (like asking for the last sent email or sending a new email), it forwards it directly to the React Agent.

Triage Router Node

  • This node is responsible for deciding what to do with each incoming email.
  • Based on the email's content and metadata, it routes the message to one of three paths:
    • Respond
    • Ignore
    • Notify

React Agent Node

  • If the Triage Router decides the assistant should respond, it forwards the email to a React Agent.
  • This agent composes a reply by analyzing context, thread history, and memory.
  • It is also capable of handling various user requests, such as:
    • Sending an email to a specified recipient
    • Telling the user the last email they sent
    • Summarizing recent conversations
    • And much more

📸 Check the image below to visualize the flow inside LangGraph Studio.

Screenshot 2025-04-27 at 20 59 42

🛠️ Getting Started

Prerequisites

  1. Install uv package manager:

    pip install uv

Local Setup

Follow these steps to get the project running locally:

  1. Clone the repository:

    git clone https://github.com/your-username/langgraph-email-assistant.git
    cd langgraph-email-assistant
  2. Create your environment file:

    cp .env.example .env

    Update it with your Auth0, Gmail, and Calendar credentials.

  3. Set up the virtual environment:

    a. Create and activate the environment:

    uv venv
    source .venv/bin/activate

    b. Install dependencies:

    uv run
  4. Run the LangGraph development server:

    uv pip install "langgraph-cli[inmem]"
    uv run langgraph dev

Google Auth Setup

To enable Gmail and Calendar integration, you’ll need to set up your OAuth credentials. Follow this tutorial to create your credentials.json and token.json:

Google OAuth Setup Guide

Once created, place them in:

src/agent/credentials/

What's Next?

We're planning to enhance the assistant's memory using:

Episodic Memory

  • Stores experiences and sequences from previous tasks
  • Enables the assistant to "recall how" it performed a task
  • Supports few-shot learning for behavior adaptation

Procedural Memory

  • Encodes rules and routines the assistant follows
  • Typically lives in code, prompt templates, or configurations
  • Provides consistency across sessions

Just like humans remember both how to ride a bike (procedural) and a memorable bike ride (episodic), our assistant will evolve to remember both the rules and experiences to be more helpful.


Contributions

Open to ideas, improvements, and feature suggestions. Feel free to fork and submit a PR!


License

MIT License – see LICENSE for details.

About

Smart Email Assistant with Semantic Memory using LangGraph

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published