This FREE AI Agent Will Run Your Gmail Inbox (AntiGravity)
By Jono Catliff
Agentic Workflow for Gmail Automation - Detailed Summary
Key Concepts:
- Agentic Workflow: An automated system utilizing AI (specifically Large Language Models like ChatGPT or Gemini) to perform tasks within an application (in this case, Gmail).
- Anti-Gravity: A no-code platform used to build and deploy agentic workflows.
- Modal.com: A platform for hosting and running agentic workflows in the cloud for 24/7 operation.
- OAUTH: A secure protocol for granting third-party applications (like Anti-Gravity) access to user accounts (like Gmail and Google Drive) without sharing passwords.
- Environmental Variables: Securely storing sensitive information (like API keys) within the workflow environment.
- LLM (Large Language Model): AI models like ChatGPT or Gemini used for understanding and processing email content.
- Token.json: A file containing authentication credentials for accessing Google services.
- Infinite Loop Prevention: Safeguards built into the workflow to prevent it from endlessly processing emails sent as a result of its own actions.
1. Introduction & Use Cases
The video demonstrates building a completely free, agentic workflow to automate tasks within a Gmail inbox. The speaker, Jono (founder of two seven-figure businesses, a 400-person AI automation community, and an AI agency), highlights the potential for automating significant portions of Gmail usage. Specific use cases presented include:
- Email Sorting: Categorizing emails into existing labels (e.g., personal, accounting, promotions). The speaker notes having 25,000 emails accumulated over 20 years.
- Draft Reply Creation: Automatically generating draft responses to incoming personal emails.
- Promotional Email Archiving: Automatically archiving unwanted promotional or social media notifications.
- Email Forwarding: Forwarding specific email types (e.g., invoices) to designated recipients (e.g., accountant) or uploading them to Google Drive/QuickBooks.
- Attachment Handling: Automatically saving attachments to Google Drive.
2. Workflow Overview & Core Logic
The core of the workflow operates as follows:
- Email Reception: The system monitors the Gmail inbox for incoming emails.
- Labeling: Upon receiving an email, the workflow labels it based on its content (e.g., "miscellaneous," "personal," "accounting").
- Action Execution: Based on the assigned label, the workflow performs a specific action:
- Attachment Present: Upload to Google Drive.
- Personal Email: Create a draft reply.
- Accounting Email: Forward to accountant.
- Promotional/Social Email: Archive.
The system is designed to be highly customizable, allowing for the creation of numerous labels and associated actions.
3. Tooling & Setup – Anti-Gravity & Modal.com
The workflow is built using Anti-Gravity, a no-code platform. The process involves:
- Anti-Gravity Download & Login: Downloading and logging into Anti-Gravity.
- Parent Folder Creation: Creating a dedicated folder (e.g., "demo Gmail") within the user’s file system to contain all workflow files. This folder acts as the root directory for the project.
- Explorer Interface: Understanding the Anti-Gravity interface: Explorer (file/folder management, similar to Google Drive), central workspace (file content display), and Agent (the AI-powered workflow builder).
- Agent Instructions (agent.md): Creating a markdown file (
agent.md) containing guidelines for the AI agent, defining its behavior and purpose. This acts as a "training manual" for the AI. The speaker provides a pre-builtagent.mdfile for users to download.
4. Connecting to Google Services – OAuth & Credentials
Connecting Anti-Gravity to Gmail and Google Drive requires:
- Google Cloud Console: Accessing the Google Cloud Console.
- Project Creation: Creating a new Google Cloud project (e.g., "anti-gravity Gmail").
- API Enablement: Enabling the Gmail API and Google Drive API within the project.
- OAuth Consent Screen: Configuring the OAuth consent screen, specifying application name, support email, and authorized users.
- Credential Creation: Creating OAuth client ID credentials (desktop application type).
- Downloading Credentials: Downloading the
client_secret.jsonfile containing the OAuth credentials. - Storing Credentials: Importing the
client_secret.jsonfile into Anti-Gravity. - Authentication: Authorizing Anti-Gravity to access Gmail and Google Drive through the OAuth flow.
- Token.json Generation: Generating a
token.jsonfile containing the authentication token.
5. Cloud Deployment – Modal.com
To ensure 24/7 operation, the workflow is deployed to Modal.com:
- Modal Account: Creating a free account on Modal.com.
- Modal Instructions (modal-instructions.md): Creating a markdown file (
modal-instructions.md) containing instructions for deploying the workflow to Modal.com. A pre-built file is provided. - Environmental Variables: Storing sensitive information (like the ChatGPT API key) as environmental variables within Modal for security.
- Deployment: Using Anti-Gravity to push the workflow to Modal.com.
6. AI Integration – ChatGPT API Key
The workflow utilizes a Large Language Model (LLM) to analyze email content and determine appropriate actions.
- ChatGPT API Key: Obtaining a ChatGPT API key (or using Google Gemini). The speaker notes a $5 credit requirement for ChatGPT.
- Secure Storage: Storing the API key securely using a service like v.example.
- Integration: Integrating the API key into the Anti-Gravity workflow.
7. Workflow Execution & Safeguards
- Workflow Trigger: The workflow is triggered every 60 seconds, processing emails received within the last 20 minutes.
- Action Matrix: Defining the actions to be performed based on email labels.
- Safeguards:
- Infinite Loop Prevention: Preventing the workflow from endlessly processing emails sent as a result of its own actions by excluding emails from the user’s own address.
- Duplicate Processing Prevention: Adding a label ("AI processed") to emails after processing to prevent them from being processed multiple times.
8. Future Expansion & Resources
The speaker suggests numerous possibilities for expanding the workflow, including:
- Custom Label Creation: Adding custom labels to categorize emails more specifically.
- Slack Summaries: Sending daily summaries of important emails to Slack.
- Google Sheets Integration: Adding data from emails to Google Sheets.
- CRM Integration: Extracting information from emails (e.g., leads) and adding it to a CRM system.
Resources mentioned:
- Workflow Blueprints: Available in the video description.
- AI Automation Community: A 400-person community for learning AI automation.
- AI Agency: Services for implementing AI solutions.
- Modal.com: https://modal.com
- Anti-Gravity: https://anti-gravity.google
- v.example: (for secure API key storage)
9. Conclusion
The video provides a comprehensive guide to building a powerful, free, and automated Gmail workflow using Anti-Gravity and Modal.com. The speaker emphasizes the potential for significant time savings and increased efficiency through AI-powered automation, and encourages viewers to explore the provided resources and customize the workflow to their specific needs. The key takeaway is that complex automation is now accessible to anyone, regardless of technical expertise.
Chat with this Video
AI-PoweredHi! I can answer questions about this video "This FREE AI Agent Will Run Your Gmail Inbox (AntiGravity)". What would you like to know?