A smart email and calendar management system powered by Gemini Pro that automatically processes incoming emails and manages calendar events.
- Automated Email Processing: Monitors inbox for new emails every minute
- Smart Email Responses: Generates contextual email responses using Gemini Pro
- Calendar Management: Automatically handles calendar event creation, updates, and deletions
- Gmail Integration: Seamlessly works with Gmail for email management
- Google Calendar Integration: Direct integration with Google Calendar for event management
├── main.py # Main application entry point
├── agents.py # AI agents configuration and prompts
├── models.py # AI model configurations
├── tools/
│ ├── gmail_tools.py # Gmail API integration tools
│ ├── calendar_tools.py # Google Calendar API tools
│ └── logger.py # Logging utilities
- Python 3.x
- Google Cloud Project with Gmail and Calendar APIs enabled
- Google OAuth 2.0 credentials
-
Clone the repository
-
Install dependencies:
# setup a virtual environment python -m venv venv source venv/bin/activate pip install -r requirements.txt
-
Generate the API Key and save under
.env
-
Set up Google OAuth 2.0 credentials and save them appropriately
-
Click on create API Key
-
Select the project from the dropdown
In case you do not have any existing Google Cloud Projects that appear in the dropdown, create a new Google Cloud Project at https://console.cloud.google.com/projectcreate with the name of your choice and then resume creating a new API key under this newly created project
-
Copy the generated API Key
-
Open the project in any IDE of your choice (For eg.
VSCode
) -
Rename the file
.env.example
to.env
-
Paste the API Key as
GOOGLE_API_KEY=AIzaXXXXXXXXXXXXXXXXXXXXXX
-
Restart the IDE so that it recognizes the API key
-
Go to https://console.cloud.google.com/auth/overview. Click on
Get Started
-
Under App Information, give any name to your app and select your email id from the drop down under user support email and click next
-
Under Audience, select external and click next
-
Put any email id under contact information and click next
-
Accept the terms and conditions and click continue
-
Now go the clients section and click on Create Client
-
Select application type as desktop application and give it any name. Then press Create.
-
Click on Download JSON and download the credentials file
-
Go to the project's root directory and paste the file. Rename it to
credentials.json
. This is an essential step for our backend code to recognize the client -
Go to the Audience section and click on Publish App

-
Now at the top search bar on the Google cloud dashboard, search for calendar and click on Google Calendar API
-
Click on Enable
-
Similarly, search for Google Gmail API and enable it
We are all set!
Run the main application:
python main.py
In case you are running the app in a terminal session different from the one in which you activated virtual environment, run the app using:
source venv/bin/activate && clear && python main.py
The assistant will:
- Check for new emails every minute
- Process emails using AI to understand context and requirements
- Generate appropriate responses and create drafts
- Handle calendar events when scheduling is involved
Key dependencies include:
- google-api-python-client: Google API client library
- langgraph: For creating reactive AI agents
- schedule: For periodic task scheduling
Ensure proper setup of:
- Google OAuth 2.0 credentials
- Gmail API access
- Google Calendar API access
Here are some examples of the Email Assistant in action:
This project is licensed under the MIT License - see the LICENSE file for details.