This script fetches your latest Gmail message and summarizes it using Google Cloud Vertex AI (Gemini), with the tone and style determined by a configurable agent persona.
- Python 3.9 or newer
- Google Cloud project with:
- Vertex AI API enabled
- Gmail API enabled
python3 -m venv venv
source venv/bin/activate
pip install google-auth google-auth-oauthlib google-api-python-client google-cloud-aiplatform python-dotenv- Place
main.pyin your project folder. - Download
client_secret.jsonfrom Google Cloud Console. - Enable the Gmail API for your project.
- Set your desired prompt in
agents/lisa_luckas.txt. - Run the script:
python3 main.py| File | Description |
|---|---|
main.py |
Main script |
client_secret.json |
OAuth credentials (keep private) |
token.json |
Auto-generated after authentication |
agents/lisa_luckas.txt |
Prompt for Lisa Luckas, your AI news agent |
- Authenticates with Gmail.
- Fetches the latest unread email.
- Loads the persona-based prompt from
agents/. - Sends content to Vertex AI (Gemini).
- Outputs a concise, publishable news-style summary.
- Do not share
client_secret.jsonortoken.json. - Ensure the Gemini model is available in your region (e.g.,
us-central1). - You can create additional agent prompt files in
agents/, e.g.,cheng_li.txtorsofia_orfeo.txt.
- Ensure billing is enabled on your Google Cloud project.
- Use a supported model name and region.
- 429 errors from Vertex AI mean your quota was temporarily exceeded.
MIT License © MAKE Europe GmbH