Connecting an agent to Gmail takes an afternoon. Keeping it connected for a month is the hard part. The first token expires, a scope needs re-approval, a daily cap trips, and an agent that ran fine in a demo goes quiet at 3 a.m.
None of this is a bug. Gmail is designed around a person who signs in, clicks "Allow" and stays in the loop. An autonomous agent breaks every one of those assumptions. This article covers where the friction comes from, with numbers from Google's own documentation, and when Gmail is still the right choice.
What are you actually connecting an agent to?
Two different jobs get called "Gmail for AI agents", and they need different answers.
The first is an agent that works inside your inbox: it summarizes your threads, drafts replies, files things. The mailbox is yours, you authorized the access, and you are around to fix it when it breaks.
The second is an agent that has its own email address. It signs up for services, receives verification codes, talks to vendors, replies to customers. Nobody owns that inbox except the agent.
Gmail handles the first job acceptably. It handles the second badly, and most of the problems below come from trying to stretch the first setup into the second.
Problem 1: Authentication assumes a person
To read mail through the Gmail API, someone creates a Google Cloud project, enables the API, configures an OAuth consent screen, picks scopes and generates credentials. The result is a flow where a human opens a browser, signs in and approves access.
An agent can't do that on its own. Someone has to do it for every inbox, and that someone has to go back whenever the grant changes. You cannot tell an agent "make yourself an email address" and have it finish.
Problem 2: The scopes you need are restricted
Google splits Gmail scopes into sensitive and restricted. gmail.send is sensitive. The ones an agent needs to actually work with a mailbox are restricted:
- gmail.readonly
- gmail.modify
- gmail.compose
- https://mail.google.com/ (full access, including permanent deletion)
There is little middle ground. gmail.modify grants read, write and send together, so an agent that only needs to read verification codes still holds the key to delete everything.
For a personal script this is fine. For a product other people use, it matters: restricted scopes require OAuth app verification, and if your app stores or transmits that data on servers, Google also requires a security assessment. Until verification is done, an app that shows the "unverified" warning screen is capped at 100 new users in total, and Google notes verification can take months.
Problem 3: Tokens expire in ways agents don't notice
An agent that runs unattended finds out about token rules the hard way. Google's OAuth documentation lists the cases:
- Testing status — an external app in Testing gets refresh tokens that expire in 7 days.
- Inactivity — a refresh token not used for six months stops working.
- Token limit — each Google Account can hold 100 refresh tokens per OAuth client ID. Past that, the oldest is invalidated without warning.
The agent sees none of this coming. It sees the next call fail:
Someone then has to notice, find the account and repeat the consent flow. For a human-owned mailbox that is an annoyance. For a fleet of agents, each with its own inbox, it is a standing maintenance job.
Problem 4: Sending limits are tuned for people
Gmail's caps assume a person typing messages:
Workspace also caps unique recipients and external recipients per day, and SMTP, POP and IMAP sends are limited to 100 recipients per message. When a limit trips, Google says the account can't send for up to 24 hours. Workspace documentation adds that accounts might be suspended for exceeding limits.
The Gmail API adds a second layer: 6,000 quota units per user per minute, where messages.send costs 100 units, messages.get 20 and messages.list 5. An agent that polls an inbox and fetches each message individually burns that budget faster than it seems.
Google doesn't publish a policy on agent accounts specifically, so treat claims that Gmail "bans agents" with caution. What the documentation does show is that nothing here is designed with unattended software in mind.
Problem 5: The address belongs to a person's account
A Gmail address is tied to a Google Account: its recovery options, its security checks, its sign-in prompts. App passwords, the usual shortcut for scripts, need 2-Step Verification and are unavailable for work and school accounts and for accounts with Advanced Protection. Google itself recommends avoiding them when possible.
An agent in a pipeline also inherits the account's risk. A suspicious sign-in from a cloud server can put the whole account, with your real mail in it, behind a verification step the agent can't pass.
What an agent-native inbox looks like
The fix is not a cleverer Gmail wrapper. It is an inbox whose registration, authentication and API were built for software from the start. Four properties matter:
- Self-registration. The agent creates its own address with no human in the loop, no email confirmation and no credit card.
- Machine-readable auth. Short-lived tokens that refresh themselves, and errors that tell the agent how to recover.
- Full inbox access. Read, search, reply, not just send.
- A protocol models already know. The fewer proprietary SDK calls the agent has to learn, the fewer it gets wrong.
How Atomic Mail Agentic handles it
Atomic Mail Agentic is an email API built for this. It is in open alpha, and addresses use the @atomicmail.ai domain.
Registration without a human. The agent requests a challenge, solves a scrypt proof-of-work locally, and gets a session. No domain, no verification email, no card:
The session token lasts 1 hour. From it the agent mints a capability token that lasts 2 minutes and has to be refreshed every couple of minutes.
Errors an agent can act on. Authentication errors carry a hint and a docs_url:
The agent reads the hint and repairs itself instead of paging you.
A full inbox over JMAP. Mail is handled through JMAP (RFC 8620 and 8621), so an agent can search, read and reply, not only send. JMAP is JSON over HTTP and well represented in training data, which means a model can write correct calls without learning a vendor SDK.
Ready-made connections. There is an MCP server (npx @atomicmail/mcp-gh-pages), a hosted MCP endpoint, an AgentSkill CLI, a LangChain toolkit, an n8n node and a Dify plugin. Direct JMAP over HTTPS works from any language.
What it doesn't do yet
It is an open alpha. Accounts are free, with a 100 MB storage quota and strict rate limits, and the public stable release is still ahead. If you need a custom domain or high-volume bulk sending today, check the current docs before you commit.
When Gmail is still the right call
Use Gmail when the mailbox is yours and the agent is an assistant on top of it. Reading your own threads, drafting replies for you to approve and labeling mail are all fine. You're present, you can re-authorize, and the volume stays human-sized. A Workspace tenant where one team controls consent also removes most of the verification friction.
Move to an agent-native inbox when any of these is true:
- The agent needs its own address, not yours.
- You run more than a handful of agents, each with a separate inbox.
- The agent has to sign up for services and receive codes on its own.
- No human will be around to click through a consent screen.
FAQ
Can an AI agent use Gmail?
Yes, through the Gmail API with OAuth or through IMAP and SMTP with an app password. It works best when the agent acts on a mailbox you own and supervise. It becomes fragile when the agent runs unattended or needs its own address.
Does Gmail allow bots and automation?
Gmail allows API access under its terms and limits. It doesn't offer a path for automated accounts as such. Google's documentation lists sending caps and notes that accounts might be suspended for exceeding them.
How do I give an AI agent its own email address?
Create a dedicated inbox for the agent rather than reusing a personal one. With an agent-native service the agent can register itself through an API call, with no human sign-up step.
Why does my Gmail OAuth token keep expiring?
Common causes are an app left in Testing status (7-day refresh tokens), a token unused for six months, or too many tokens for one account and client ID (the oldest of 100 is revoked). Publishing the app and storing the refresh token safely fixes the first two.
Is Gmail API free for AI agents?
Usage up to 80 million quota units per project per day is not billed, and that threshold can't be raised. Google plans charges above it later in 2026. The bigger cost is usually verification work, not quota.
What are the Gmail sending limits?
500 messages a day on personal accounts and 2,000 on Google Workspace. The Gmail API allows up to 500 recipients per message.
Can I use an app password for my agent?
If 2-Step Verification is on and the account isn't a work, school or Advanced Protection account, yes. Google recommends avoiding app passwords when possible, and they give the agent full account-level access.
Do I need Gmail to build an email agent?
No. Any mailbox with an API will do. For agents that need their own identity, an inbox built for agents removes the OAuth and verification steps.
Which one to use
If your agent works inside your own mailbox while you watch, Gmail with a scoped OAuth grant is enough. If your agent needs its own address, has to run for weeks without anyone approving anything, or is one of many, use an inbox it can create and repair on its own.
Atomic Mail Agentic is free in open alpha. Connect it through MCP, LangChain, n8n or plain JMAP at atomicmail.io/agents.
