Read-only Gmail intelligence. This project never modifies Gmail.
It reads messages, classifies each one with a local Ollama model, and writes an Excel report. It does not send, delete, move, label, archive, or download attachments.
- Python 3.10+
- Ollama running locally with
qwen2.5:3b(or changeOLLAMA_MODELinemail_agent.py) - A Google Cloud OAuth Desktop client with the
gmail.readonlyscope
pip install -r requirements.txt
- In Google Cloud, create an OAuth client (Desktop app).
- Download the client JSON.
- Copy
credentials/credentials.json.exampletocredentials/credentials.jsonand replace the placeholders with that client JSON. - Start Ollama and confirm the model is installed:
ollama list
python email_agent.py
The first run opens a browser so you can authorize Gmail. The token is stored as credentials/token.json in this folder only.
Reports are written to reports/. Start with MAX_MESSAGES = 10 in email_agent.py, then raise it after you have reviewed the output.
Gmail scope: https://www.googleapis.com/auth/gmail.readonly
This script cannot delete, move, archive, label, or send email.
All paths are relative to this project folder. There is no hardcoded machine-specific root.