An AI-powered Gmail assistant with a Chrome extension interface. Uses LangChain/LangGraph to interact with Gmail and Google Calendar via natural language.
- Summarize emails - Get quick summaries of recent inbox messages
- Send emails - Compose and send emails through natural language
- Check calendar - View upcoming calendar events
- Chrome extension - Chat interface directly in Gmail
├── gmail_agent.py # Main agent with Gmail/Calendar tools (Flask server)
├── simple_agent.py # Basic example agent with calculator tool
└── my-extension/
├── content.js # Chrome extension content script
└── manifest.json # Extension manifest
pip install flask flask-cors python-dotenv langchain langchain-openai langgraph google-auth google-auth-oauthlib google-api-python-clientCreate a .env file in the root directory:
OPENAI_API_KEY=your_openai_api_key_here
- Go to Google Cloud Console
- Create a new project (or select existing)
- Enable the Gmail API and Google Calendar API
- Create OAuth 2.0 credentials (Desktop application)
- Download the credentials and save as
credentials.jsonin the root directory
python gmail_agent.pyOn first run, a browser window will open for Google OAuth authorization. After authorizing, a token.json file will be created.
- Open Chrome and go to
chrome://extensions/ - Enable "Developer mode" (top right)
- Click "Load unpacked"
- Select the
my-extensionfolder
- Open Gmail
- Click the robot button in the bottom-right corner
- Type commands like:
- "Summarize my recent emails"
- "What's on my calendar this week?"
- "Send an email to example@email.com about the meeting"
simple_agent.py is a minimal example showing how to create a LangChain agent with a calculator tool:
python simple_agent.py- Never commit
.env,credentials.json, ortoken.jsonto version control - These files are included in
.gitignore