Most email triage demos stop at classification. They read your inbox, sort messages into buckets, and call it done. You still have to write the replies yourself.
Let's build one that closes the loop.
What you'll build
An OpenClaw agent workflow that:
- Pulls your unread emails
- Classifies each one (urgent, needs reply, FYI, spam)
- Drafts replies for the "needs reply" bucket
- Shows you the drafts for approval before sending
No copy-pasting between tabs. No context-switching. The agent reads, thinks, writes, and waits for your go-ahead.
Prerequisites
You need the Nylas plugin installed. If you followed The Nylas Plugin for OpenClaw, you're already set.
If not:
openclaw plugins install @nylas/openclaw-nylas-plugin
openclaw config set plugins.entries.nylas.config.apiKey nyl_v0_your_key_here
openclaw gateway restart
Full setup: cli.nylas.com/guides/install-openclaw-nylas-plugin
Step 1: Pull unread emails
Start by asking your agent:
"Show me my unread emails from today."
The agent calls nylas_list_emails with { unread: true } and returns a summary — sender, subject, and a preview of each message.
A typical Monday morning might look like:
| # | From | Subject |
|---|---|---|
| 1 | boss@company.com | Q3 planning — need your input by EOD |
| 2 | ci@github.com | Build failed on main |
| 3 | vendor@saas.io | Your invoice is ready |
| 4 | newsletter@techblog.com | This week in distributed systems |
| 5 | alice@company.com | Can you review my PR? |
Five emails. Three need a reply. One is informational. One is noise.
The same search capabilities work for automated workflows too — like extracting OTP codes from email for test automation.
Step 2: Classify
"Classify these emails: urgent, needs-reply, fyi, or skip."
The agent reads the full body of each message (calling nylas_get_email for each) and categorizes:
- Urgent: #1 (boss, deadline today)
- Needs reply: #2 (CI failure, team needs to know you're on it), #5 (PR review request)
- FYI: #3 (invoice, no action needed right now)
- Skip: #4 (newsletter)
No rules engine. No regex. The agent reads context the way you would.
Step 3: Draft replies
"Draft replies for the urgent and needs-reply emails. Keep them short."
The agent calls nylas_create_draft for each one. For more on how sending works under the hood, see the send email guide.
To boss@company.com:
"Got it — I'll have my section ready by 4pm. Want me to drop it in the shared doc or send it over email?"
To ci@github.com:
"Looking into the build failure now. Likely the config change from yesterday — I'll push a fix within the hour."
"I'll review your PR this afternoon. Anything specific you want me to focus on?"
The drafts sit in your Drafts folder. Nothing has been sent yet.
Step 4: Review and send
"Show me the drafts you just created."
The agent lists the drafts. You read them, maybe tweak the wording:
"Change the reply to Alice — say I'll look at it after lunch, not this afternoon."
The agent updates the draft. When you're satisfied:
"Send all three drafts."
The agent calls nylas_send_email for each one. Done.
Making it a daily habit
Once you trust the workflow, you can compress it into a single prompt:
"Check my unread emails. Classify them. Draft short replies for anything urgent or that needs a response. Show me the drafts before sending."
The agent chains all four steps: list → classify → draft → present. You review once, approve once, and move on.
Why drafts matter
Skipping the draft step is tempting. Don't. Here's what goes wrong:
- The agent misreads tone. A blunt reply to your boss's email lands badly.
- The agent hallucinates a commitment. "I'll have it done by noon" when you meant end of day.
- The agent replies-all to something that should've been a DM.
Drafts are the safety net. The agent does the heavy lifting; you keep the final say. If you're building your own triage agent in Python, the AI email triage guide covers the implementation details. For a deeper dive into the architecture, see building an AI email triage agent with the CLI.
Beyond email: adding calendar context
The plugin also has calendar tools. You can layer them in:
"Before drafting the reply to my boss, check my calendar for today. If I have meetings until 3pm, adjust the timeline in the reply."
The agent calls nylas_list_events, sees you're booked until 3pm, and drafts: "I'll have my section ready by 5pm" instead of 4pm. For more on calendar management, see the calendar guide.
This is where single-tool agents fall apart. Email-only tools can't see your calendar. Calendar-only tools can't draft replies. The Nylas plugin gives your agent the full picture.
Prefer the terminal?
If you want to triage email without an agent — just you and the command line — the Nylas CLI gives you the same email, calendar, and contacts access from your terminal. The guides walk through common workflows step by step.
Links
- Previous post: The Nylas Plugin for OpenClaw
- npm: @nylas/openclaw-nylas-plugin
- Nylas CLI: cli.nylas.com — email, calendar & contacts from your terminal
- Nylas docs: developer.nylas.com/docs/v3
Five unread emails. Three replies drafted, reviewed, and sent. Total time: under two minutes.
Top comments (0)