---
title: "Build an AI Inbox Triage Agent That Drafts Your Replies"
description: "Step-by-step guide to building an always-on AI inbox triage agent with Hermes on AgentRoost — classifies emails, drafts replies, runs 24/7 with included LLM credits."
canonical: https://agentroost.app/en/blog/ai-inbox-triage-agent-drafts-replies
date: 2026-05-30T20:00:00Z
---

[Canonical URL](https://agentroost.app/en/blog/ai-inbox-triage-agent-drafts-replies)

Most email overload isn't about volume — it's about the cognitive overhead of deciding what matters, what can wait, and what deserves a thoughtful reply right now. An AI triage agent shifts that overhead off your plate: it reads the inbox continuously, sorts messages by urgency and type, and drops a draft reply into your Drafts folder for anything it can handle. You show up, review, and send. That's it.

This guide walks through building exactly that with **Hermes** on AgentRoost. Hermes is a persistent AI assistant framework — always-on, context-aware across days, and capable of running scheduled tasks. Unlike a script you fire manually, Hermes stays alive, checks your inbox on a schedule, and keeps a rolling memory of what it has already triaged so it doesn't double-process threads.

## What the Agent Actually Does

Before touching any config, it helps to be precise about the pipeline:

1. **Poll** — every N minutes, connect to an IMAP mailbox and fetch unread messages (or messages with a specific label/folder).
2. **Classify** — for each message, decide which bucket it falls into:
   - Needs human decision (complex, sensitive, requires context the agent doesn't have)
   - Can be answered with a standard reply (FAQs, scheduling requests, acknowledgements)
   - Noise / newsletters — archive silently
3. **Draft** — for "can be answered" messages, generate a contextually appropriate reply using the LLM and save it to Drafts via SMTP/IMAP APPEND.
4. **Notify** — send you a Telegram message summarising what happened: "3 triaged, 2 need your attention."

The result: you open your email client and find a Drafts folder with ready-to-review responses. High-signal items are flagged in Telegram. Low-signal items are already archived.

## Setting Up the Hermes Agent on AgentRoost

Hermes runs on AgentRoost as a persistent, always-on workspace. Here is the exact journey:

1. Sign up at [agentroost.app](https://agentroost.app) (email/password, Google, Microsoft, or Discord).
2. Go to **[Agents → Hermes](/en/agents/hermes)**, click **Create**, and give it a name like `inbox-triage`.
3. Once provisioned (~2 minutes), open the AgentRoost manager bot on Telegram and `/start` your new agent.
4. Configure your agent's connector hooks (see below). AI credits are already loaded — no API key to paste anywhere.

That's the full infrastructure step. No servers, no Docker, no SSL certificate.

## Configuring the Inbox Connector

Hermes uses **connector hooks** — named integrations that the agent can call as tools. For email triage you need two:

**IMAP read hook** — connects to your mailbox and fetches unread messages. Provide:

```yaml
connector: imap_reader
host: imap.gmail.com        # or your provider's IMAP host
port: 993
tls: true
username: you@example.com
password: "{{secret:IMAP_PASSWORD}}"
folder: INBOX
fetch_limit: 20             # messages per poll cycle
mark_seen: false            # let the agent track state, not the seen flag
```

**SMTP draft hook** — saves generated text as a Draft (not send). Use Gmail's `IMAP APPEND` to the `[Gmail]/Drafts` folder, or your provider's equivalent.

```yaml
connector: smtp_draft
host: smtp.gmail.com
port: 587
starttls: true
username: you@example.com
password: "{{secret:SMTP_PASSWORD}}"
draft_folder: "[Gmail]/Drafts"
```

> **Gmail note:** create an [App Password](https://myaccount.google.com/apppasswords) rather than using your main password. Outlook/365 works the same way via `imap.outlook.com` / `smtp-mail.outlook.com`.

Secrets go into AgentRoost's secret vault — they never appear in logs.

## The Triage Prompt

The heart of the agent is its system prompt plus the per-message classification call. A practical starting point:

```
You are an email triage assistant for {{user_name}}.

For each email you receive, output JSON with this shape:
{
  "id": "<message-id>",
  "bucket": "draft" | "flag" | "archive",
  "priority": "high" | "normal" | "low",
  "draft_body": "<reply text or null>",
  "reason": "<one sentence>"
}

Rules:
- bucket=draft  → you can write a complete, professional reply; save it as a Draft.
- bucket=flag   → needs the human; send a Telegram alert with the subject + sender + reason.
- bucket=archive → newsletters, automated notifications, cold outreach with no action required.

When writing drafts:
- Match the sender's register (formal → formal, casual → casual).
- Keep replies concise — under 150 words unless the email is long.
- Never invent facts. If you're unsure, switch to bucket=flag.
- Sign off as: {{signature}}
```

The `{{user_name}}` and `{{signature}}` slots are filled from Hermes's persistent memory — you set them once during onboarding and the agent carries them across every run.

## Scheduling the Poll Loop

Hermes supports **scheduled tasks** defined in the agent config:

```yaml
schedule:
  - name: inbox_poll
    cron: "*/15 * * * *"   # every 15 minutes
    task: run_triage_pipeline
```

The `run_triage_pipeline` task calls the IMAP hook, runs classification for each message, calls the SMTP draft hook for `bucket=draft` items, and fires a Telegram summary. Because Hermes persists state across runs, it keeps a set of already-processed message IDs — so a 15-minute poll never re-processes the same thread.

You can tune the cron to `"0 */1 * * *"` (hourly) during off-hours and `"*/5 * * * *"` during your work day if you want tighter coverage when you're active.

## Avoiding the Common Pitfalls

**Over-eager drafting.** Start with a conservative prompt that flags anything ambiguous. A draft sent without review that sounds off is worse than no draft at all. After a week, look at which `flag` items you actually could have drafted and tighten the rules.

**Thread context.** IMAP gives you the latest message but not the full thread history by default. Fetch the `References` header and pull the last 2-3 messages in the thread before classifying. Hermes's memory layer can cache thread summaries so it doesn't re-fetch the whole chain every cycle.

**Rate limits.** IMAP connections have per-account limits. Keep `fetch_limit` reasonable (20-50) and add a short sleep between batches if you have a high-volume inbox.

**False archives.** Never auto-delete. Set `bucket=archive` to apply a label (e.g., `_triaged/auto`) and remove from inbox — so you can audit or recover anything the agent mis-classified.

## Cost Reality

On AgentRoost, the LLM calls that power classification and draft generation run against **included credits** — you are not paying per-token on top of your subscription. A typical 15-minute poll that processes a batch of emails and drafts a handful of replies draws from that pool at a rate most subscriptions handle comfortably. The base plan starts at **$19.99/mo all-in**, which covers the persistent compute, the Telegram bot provisioning, and the AI credits. No surprise bills from OpenAI or Anthropic.

If you run a higher-volume inbox, the Plus or Pro tiers give you more included credits and more compute. You can [compare plans](/en/pricing) to see what fits.

## Try It in Two Minutes

The full stack — persistent agent, IMAP connector, LLM calls, Telegram notifications — runs as a single Hermes workspace. There is nothing to install, no Docker image to maintain, no SSL certificate to renew.

Sign up, spin up a Hermes agent, paste in the connector config and triage prompt above, set the cron schedule, and your inbox triage is live. [Get started with Hermes →](/en/agents/hermes)

If you want to go further — adding a step that logs triage decisions to a Google Sheet, or routing certain senders to a higher-priority queue — you can extend the agent's toolset with additional connector hooks without changing anything about the core setup.

Your inbox becomes a review queue. That's a meaningful shift.
