> For the complete documentation index, see [llms.txt](https://support.mailagent.email/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.mailagent.email/gmail-addon/ai-agent.md).

# AI Agent

The AI Agent is the core feature of MailAgent. When enabled, it autonomously monitors your inbox for new emails and generates responses based on your configuration.

## Enabling the Agent

At the top of the MailAgent sidebar, you'll find the **AI Agent** toggle switch:

* **ON** — The agent actively watches for new unread emails and responds automatically.
* **OFF** — The agent is inactive. You can still process emails manually.

## How It Works

When the AI Agent is enabled:

1. **Gmail Push Notifications** — Gmail sends a notification to MailAgent whenever a new email arrives.
2. **Thread Analysis** — The agent reads the full email thread for context.
3. **Response Generation** — Using your configured system prompt, integrations, and email history, the AI generates an appropriate response.
4. **Action** — Depending on your [Draft Mode](/gmail-addon/draft-mode.md) setting:
   * **Draft Mode ON** — A draft is created for your review.
   * **Draft Mode OFF** — The email is sent automatically.
5. **Labeling** — The email is labeled according to your [Email Labels](/gmail-addon/email-labels.md) configuration.

## Daily Limits

Your subscription plan determines how many emails the agent can process per day:

| Plan     | Daily Limit |
| -------- | ----------- |
| Starter  | 10          |
| Standard | 50          |
| Pro      | Unlimited   |

The current usage count is displayed below the agent toggle. When you reach your limit:

* The agent will stop processing new emails.
* You'll see a notification with your current usage.
* The counter resets automatically every 24 hours.

## Best Practices

* **Start with Draft Mode ON** — Review the AI's responses before letting it send emails directly. This helps you fine-tune the system prompt.
* **Write a clear system prompt** — The more specific your [Custom Prompt](/gmail-addon/custom-prompt.md), the better the AI's responses will match your expectations.
* **Connect knowledge bases** — Add [GitBook integrations](/gmail-addon/integrations.md) so the AI can reference your product documentation for accurate answers.
* **Use classification labels** — Set up [Email Labels](/gmail-addon/email-labels.md) so you can easily track what the agent has handled.

## Automatic Deactivation

The agent will automatically disable itself if:

* Your Google OAuth token expires and cannot be refreshed.
* Your daily email limit is reached.
* There is a persistent authentication error.

When this happens, you'll need to re-enable the agent manually from the sidebar.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://support.mailagent.email/gmail-addon/ai-agent.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
