# AI email agent for Gmail: triage with labels and drafts

Gmail organizes mail with labels: one message can carry several, and archiving is just removing the Inbox label. That makes Gmail triage cheap to undo, which is what you want from a bot.

This page covers what Rakazo's Gmail connection can do for the [AI email agent](https://rakazo.com/use-cases/ai-email-agent/), how to map its three groups to labels, and what stays off limits.

Updated November 23, 2026.

## What it does

- Applies Reply needed, FYI and Low priority labels
- Saves drafts in the right thread
- Reads attachments, such as receipts and invoices
- Finds contacts to address a reply correctly

## Worked example

The same fourteen emails as on the [AI email agent](https://rakazo.com/use-cases/ai-email-agent/) page, triaged from a Gmail inbox.

### Instructions

```text
You triage the user's email so they only read what matters.

- Sort new mail into: reply needed, for your information, and low priority.
- For anything that needs a reply, write a short draft in the user's voice.
- Never send, delete or archive email unless the user asks for that message.
- Learn from corrections: when the user says something was sorted wrong, save the rule to memory.
```

### Prompt

```text
Triage the email that came in since 8:00 (below, as the email app would return it). Draft replies for anything that needs one. I'm Maya, head of ops at Northwind Coffee.

1. From: Priya Shah <priya@harbor-design.co> | 08:14 | Subject: Friday review
Hi Maya, something came up Friday morning. Could we move the packaging review to the afternoon? 2 or 3pm both work for me.

2. From: billing@cloudhost.example | 08:20 | Subject: Your card ending 4412 expires on Nov 30
Update your payment method to avoid service interruption.

3. From: Sam Ortega <sam@ortega-roasters.com> | 08:31 | Subject: Wholesale order #2291
Hi Maya, can you confirm the 40kg of Huila arrives before Dec 5? We have a holiday blend run that week. If not, we'll need 20kg of anything similar to bridge.

4. From: newsletter@specialtycoffee.example | 08:40 | Subject: This week in coffee: harvest outlook

5. From: no-reply@calendar.example | 08:45 | Subject: Updated invitation: Ops weekly (Tue 10:00 -> Tue 10:30)

6. From: Leah Kim <leah@northwindcoffee.com> | 09:02 | Subject: Q4 numbers for the board deck
Maya, I need the Q4 ops numbers (on-time delivery, waste %, cost per kg) by noon Thursday for the board deck. Can you send them or tell me who should?

7. From: deals@officesupply.example | 09:10 | Subject: 30% off paper cups this week

8. From: Tomas Riedel <tomas@riedel-logistics.de> | 09:22 | Subject: Rate change from January
Hello Maya, from January 1 our pallet rate to your Leeds site rises from EUR 84 to EUR 91. Happy to discuss a 12-month commitment at EUR 87. Let me know by Dec 10.

9. From: GitHub <noreply@github.com> | 09:30 | Subject: [northwind/site] 3 new commits

10. From: Hannah Reed <hannah@northwindcoffee.com> | 09:41 | Subject: FYI roaster maintenance
Just so you know, Roaster 2 is down for maintenance Wed 6-10am. Production plan already adjusted, nothing needed from you.

11. From: events@expo.example | 09:50 | Subject: Last chance: early bird tickets

12. From: Dev Patel <dev@brightcafe.co.uk> | 10:05 | Subject: Complaint: last two deliveries late
Maya, our last two deliveries arrived after 11am, after our morning rush. This is the second time this month. What's going on, and can you guarantee before-9am delivery?

13. From: no-reply@bank.example | 10:12 | Subject: Your statement is ready

14. From: Ines Duarte <ines@northwindcoffee.com> | 10:20 | Subject: Interview panel Thursday?
Could you sit on the panel for the logistics coordinator role, Thu 3-4pm? Totally fine to say no.
```

### Apps it uses

- [Gmail](https://rakazo.com/integrations/gmail/): reads, labels and drafts
- [Google Calendar](https://rakazo.com/integrations/googlecalendar/): checks a slot before a draft offers it

### Output (Claude Sonnet 5.5, unedited)

Hi Maya, here's the triage of the 14 emails. I haven't sent, archived or deleted anything.

## Reply needed

**1. Priya Shah: Friday review** (08:14)
> Hi Priya, no problem. 3pm on Friday works for me. I'll move the invite. Thanks for letting me know. Maya

I picked 3pm, so change it if 2pm suits you better. I haven't checked your calendar.

**3. Sam Ortega: Wholesale order #2291** (08:31). This is time-sensitive.
> Hi Sam, thanks for flagging the Dec 5 deadline. I'm checking the Huila arrival date with the team and will confirm by [day]. If it can't make it, I'll send you 20kg of a similar coffee to bridge. Maya

You need to confirm the Huila ETA before you send this.

**6. Leah Kim: Q4 numbers** (09:02). Due by noon Thursday, Nov 26.
> Hi Leah, I'll get you on-time delivery, waste % and cost per kg by noon Thursday. [Or: [name] will send them.] Maya

Decide whether you'll send the numbers yourself or hand it to someone.

**8. Tomas Riedel: Leeds rate change** (09:22). Reply by Dec 10.
> Hi Tomas, thanks for the heads-up on the January rate. We're interested in the 12-month commitment. Could you send the terms in writing? I'd like to see if we can get closer to EUR 84. I'll confirm by Dec 10. Maya

This commits you to nothing, but you may want to check volumes first. The commitment would be EUR 87 against EUR 91, which is roughly 4.4% less.

**12. Dev Patel: Late deliveries complaint** (10:05). This is a customer complaint, so I'd answer it first.
> Hi Dev, I'm sorry about the two late deliveries. I know they missed your morning rush. I'm looking into what happened and will come back to you by [day] with the cause and a fix. I'd rather give you a delivery window I can keep than promise before-9am before I've checked it. Maya

I left out a guarantee on purpose. Tell me if you want to offer one.

**14. Ines Duarte: Interview panel** (10:20). She needs a yes or no for Thursday 3-4pm.
> Hi Ines, yes, happy to join Thursday 3-4pm. Maya

I can write a decline instead if you prefer. Thursday is also the day Leah's numbers are due.

## For your information
- **2. CloudHost billing:** your card ending 4412 expires Nov 30. Update it before then to avoid an interruption. Worth doing soon, but no reply is needed. I haven't opened the link in the email.
- **5. Calendar:** Ops weekly on Tuesday moved from 10:00 to 10:30.
- **10. Hannah Reed:** Roaster 2 is down Wednesday 6-10am. The production plan is already adjusted and she needs nothing from you.
- **13. Bank statement:** it's ready to view.
- **9. GitHub:** 3 new commits on northwind/site.

## Low priority
- **4.** Specialty coffee newsletter
- **7.** Paper cups, 30% off
- **11.** Expo early-bird tickets

Which drafts should I tweak, and what should I fill in for the items marked [ ]? I'll note any sorting corrections for next time.

### Cost per run

| Model | Tokens in | Tokens out | Cost per run | Time |
| --- | --- | --- | --- | --- |
| Claude Sonnet 5.5 | 16,187 | 1,157 | $0.052 | 10s |
| GPT-6.2 Sol | 8,365 | 689 | $0.024 | 13s |
| GPT-6 Luna | 9,006 | 1,256 | $0.002 | 13s |

Measured on November 23, 2026 (Claude Sonnet 5.5 the day before) on Rakazo 0.14.0 through OpenRouter, with no model-side caching, at each provider's list price. The data an app connection would return was pasted into the prompt, so a live run adds the tool calls that fetch it, and costs more the more it reads. Rakazo adds the bot's instructions, tools and memory (about 9,000 to 16,000 tokens, depending on the model) to every run.

## Run it on a schedule

> Every weekday at 8:00 and 15:00, triage my new Gmail, label each message, and draft replies. Don't send or archive.

- Claude Sonnet 5.5: about $2.29 a month in model usage, weekdays at 8:00 and 15:00.
- GPT-6.2 Sol: about $1.04 a month in model usage, weekdays at 8:00 and 15:00.
- GPT-6 Luna: about $0.07 a month in model usage, weekdays at 8:00 and 15:00.

## What it won't do without you

- Never sends, trashes or deletes; those actions ask for approval
- Labels instead of archiving, so nothing disappears from view
- Drafts in the existing thread, so replies keep their history

## What the Gmail connection can do

- **Read:** fetch and search messages and threads, read attachments, list labels and drafts, search contacts.
- **Organize:** create labels, and add or remove labels on a message or a whole thread. Removing the Inbox label archives.
- **Write:** create drafts, reply in a thread, send a draft or a new email. Sending asks for approval.
- **Not available:** creating Gmail filters. For a rule that applies without the bot, add a filter in Gmail yourself.

## Gmail versus Outlook

|  | Gmail | Outlook |
| --- | --- | --- |
| How mail is grouped | Labels, several per message | Folders, plus color categories |
| Archive means | Remove the Inbox label | Move to the Archive folder |
| Rules the bot can create | None; filters are set in Gmail | Server-side inbox rules |
| Incremental sync | History id from the profile | Mail delta |

## Set it up

1. Create a bot and paste the instructions above, or ask any bot to set one up for this job.
2. Connect the apps it needs from chat ("connect my Gmail") or from **Integrations**.
3. Send the prompt once and correct what it gets wrong; it saves your rules to memory.
4. Ask it to turn the prompt into a routine on a schedule.

## FAQ

### Is it safe to give an AI agent access to Gmail?

The connection uses Google sign-in, and Rakazo encrypts connector credentials on the server. Every send, trash or delete asks for approval in **Ask** mode. Self-host Rakazo if the mail must stay on your own infrastructure.

### Does it work with Google Workspace accounts?

Yes, if your Workspace admin allows the app. Some organizations restrict third-party access to Gmail.

### Can it archive email?

It can, by removing the Inbox label, but only when you ask for a message or approve it. The default instructions say to label, not archive.

## More use cases

- [AI email agent](https://rakazo.com/use-cases/ai-email-agent/): Sorts new mail three ways and drafts the replies in your voice.
- [AI email agent for Outlook](https://rakazo.com/use-cases/ai-email-agent-outlook/): Folders, categories and server rules: the email agent in Outlook.
- [AI expense tracker](https://rakazo.com/use-cases/ai-expense-tracker/): Matches receipts to card charges and finds what's missing.
- [All use cases](https://rakazo.com/use-cases/)
