New Tool Radar

AI Agents & Automation

How to Build an Email Triage Agent That Sorts the Inbox by Rules

Build an email triage agent that sorts incoming mail by rules you write, so urgent mail is seen first and routine mail is filed.

Schematic illustration with three step boxes: write the triage rules, let the agent sort, and review the mistakes.

Email triage is a bounded agent job: read the inbox, apply rules, and sort each message into a folder or a priority. The rules must be written down first, because an agent that invents its own sorting criteria will sort differently every day. The check is a manual review of the sorted mail, not the agent’s confidence.

Before you start

Access to an inbox the agent can read, folders or labels to sort into, and a list of the sorting rules.

Write the triage rules first

Write the rules as a short list: urgent if the sender is a customer with a refund request, routine if it is a newsletter, spam if it matches the spam patterns. Each rule names the condition and the destination.

Keep the rules few and testable: five rules that work beat twenty rules that overlap.

Let the agent sort a day of mail

Run the agent over one day of real inbox mail and let it apply the rules. Do not let it delete anything on the first run: sorting into folders is reversible, deleting is not.

Record the rule the agent applied to each message, so a wrong sort can be traced to the rule that caused it.

Review the mistakes and fix the rules

Read the sorted mail and count the mistakes by rule: how many urgent messages landed in routine, how many newsletters landed in urgent. Fix the rule that caused the most mistakes, not the agent.

Re-run the same day of mail after the fix and compare the mistake counts.

Practice check: fictional Maple Corner inbox, 40 messages, 5 rules

The table below is fictional practice material, worked out by hand from the stated rules. It is the expected result for the practice inbox, not a run of any agent.

Rule Messages Correct Mistakes Verdict
Urgent: refund request 8 8 0 Pass
Routine: newsletter 18 17 1 Pass
File: receipts 9 9 0 Pass
Spam 5 4 1 Pass

Thirty-eight of forty messages are sorted correctly. The two mistakes are a newsletter in urgent and a spam message in routine, so the fix is in those two rules, not in the agent.

Expected result. UNTESTED: the counts in the practice table are worked out by hand, not measured by running an agent. Write your own five triage rules, run the agent over one day of mail without deleting anything, and count the mistakes by rule.

Limits

  • Do not let a new triage agent delete mail: sorting is reversible, deleting is not.
  • Fix the rule that caused the mistake, not the agent: the agent only applies the rules you wrote.

Sources

See all