Skip to content

Gmail Assistant - An AI powered agent that can read, send, draft, manage your emails seemlessly.

License

Notifications You must be signed in to change notification settings

Dhanush-Raj1/Gmail-Assistant-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

42 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“§ Gmail Assistant

End to End AI Agent Project: "AI-powered Gmail assistant for reading, searching, sending, and managing emails efficiently"



πŸš€ Project Overview

  • The Gmail Assistant is an AI-driven application that helps users interact with their Gmail accounts using natural language. Built with Agno AI (formerly Phidata), Groq LLM, and Streamlit.
  • The assistant utilizes Google OAuth 2.0 for authentication and interacts with the Gmail API to fetch and manage emails securely.
  • It allows users to:
    πŸ“© Read emails – Retrieve and summarize recent emails.
    πŸ” Search emails – Find emails based on keywords, sender, or date.
    βœ‰ Send emails – Compose and send emails via Gmail.
    πŸ“‚ Manage emails – Handle spam, categorize emails, and more.

🎯 How the Project Works

User Authentication:

The user authenticates with Gmail via OAuth 2.0. The app retrieves an access token to interact with Gmail services.

Query Processing:

The user enters a request (e.g., "Find my latest emails from John"). The input is processed and passed to the Groq-powered LLM.

AI-driven Response:

The AI agent interprets the query, calls the Gmail API, and retrieves relevant data. A structured response is generated and displayed in the UI.

Chatbot UI:

The web-based UI (built with Streamlit) allows users to interact seamlessly. User queries appear on the right, and assistant responses appear on the left, resembling a real chatbot.


πŸ› οΈ Tech Stack

Technology Description
Python Programming language used
Streamlit Web framework for UI of the assistant
Agno AI (formerly Phidata) AI framework for building agents and tools
Groq LLM LLM for natural language processing
Google OAuth 2.0 User authentication for using the gmail assistant
Gmail API Email retrieval and management

πŸ“‚ Project Structure

/πŸ“‚ Gmail-Assistant
β”œβ”€β”€ /πŸ“‚ static                 # Static assets (images, styles)
β”‚   β”œβ”€β”€ gmail-logo.png         # Logo for UI
β”œβ”€β”€ /πŸ“‚ rough                   # Research and rough work purpose
|    β”œβ”€β”€ rough.py               # rough python file 
β”œβ”€β”€ /πŸ“‚ src                     # Source code
β”‚   β”œβ”€β”€ assistant_builder.py   # Core AI logic for Gmail operations
β”‚   β”œβ”€β”€ /πŸ“‚ utils
β”‚   β”‚   β”œβ”€β”€ exception.py     # Custom exception handling
|   |   β”œβ”€β”€ helper.py        # Google Oauth authentication
β”œβ”€β”€ Pipfile                  # Dependencies (Pipenv)
β”œβ”€β”€ Pipfile.lock             # Locked dependencies
β”œβ”€β”€ requirements.txt         # List of required libraries, modules, dependencies
β”œβ”€β”€ .env                     # Environment variables (OAuth keys)
β”œβ”€β”€ README.md                # Project documentation

πŸš€ Setup & Installation

Prerequisites

Gmail API enabled with OAuth 2.0 credentials
Pipenv (for managing dependencies)

Installation Steps

1️⃣ Clone the repository:

git clone https://github.com/Dhanush-Raj1/Gmail-Assistant-Project.git
cd Gmail-Assistant-Project

2️⃣ Set up a virtual environment:

pipenv install
pipenv shell

3️⃣ Configure environment variables:

Create a .env file and add your credentials:

GROQ_API_KEY=your_groq_api_key
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_PROJECT_ID=your_project_id
GOOGLE_REDIRECT_URI=your_redirect_uri
HF_TOKEN_LLAMA=your_huggingface_token

4️⃣ Run the application:

streamlit run main.py

πŸ“ Usage Guide

πŸ”Ή Step 1: Authenticate with Gmail

  • Click on the "Authenticate with Gmail" button.
  • Sign in with your Google account and grant the necessary permissions.

πŸ”Ή Step 2: Perform Actions

Chat with the assistant in natural language

  • Chat with the gmail assistant in natural langugage. Example:
    • Give me the summary of my latest emails
    • Find me the emails related to invoice
    • Send an email to <sender_email id> conveying that I'm free on wednesday at 4.30pm and ready to meet him about the investment.
    • What is the latest email about AI news?

πŸ“© Retrieve Latest Emails

  • Click "Fetch Latest Emails" to get the most recent messages.
  • The assistant will return Sender, Subject, and Received Time (converted to IST).

πŸ” Search Emails

  • Enter a keyword, sender email, or date in the search bar.
  • The assistant will list matching emails from the Inbox and Spam folders.

βœ‰οΈ Send an Email

  • Enter the recipient’s email, subject, and message body.
  • The assistant will send the email with a structured format and a signature.

πŸ“‚ Manage Emails

  • View, organize, and handle emails based on priority, sender, or time received.
  • Spam detection and handling for junk or phishing emails.

πŸ–ΌοΈ Screenshots

✨ Authentication Page


✨ Chatbot Interface


✨ Email Summarization


πŸš€ Future Enhancements

πŸ”Ή Memory-Based Conversations
Store chat history using a vector database (FAISS or PostgreSQL).

πŸ”Ή Priority-Based Email Sorting
Categorize emails using AI-driven importance detection.

πŸ”Ή Sentiment Analysis for Emails
Analyze email tone (positive, neutral, negative) before responding.

πŸ”Ή Voice Commands Integration
Allow users to interact via voice instead of text input.

πŸ”Ή Multi-Account Support
Enable switching between multiple Gmail accounts.

πŸ”Ή Mobile App Version
Build a React Native or Flutter app for better mobile accessibility.


🀝 Contributing

πŸ’‘ Have an idea? Feel free to contribute or open an issue and pull requests!

πŸ“œ License

This project is licensed under the MIT License. Click to see the LICENSE.

About

Gmail Assistant - An AI powered agent that can read, send, draft, manage your emails seemlessly.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages