New Tool Radar

AI Agents & Automation

How to Trigger an Agent Run When a New Email Arrives

Trigger an agent run from a new email so each message is triaged as soon as it lands, without anyone forwarding it.

Schematic with three steps: Add the new-email trigger with a filter; Tell the agent what to do with; Send the test email and check the.

A new email is an event the agent can watch for: Zapier’s app triggers include a new email arriving in Gmail, and the agent receives the message data when it fires. That is the shape for inbox triage: the agent reads the subject and body, classifies the message, and routes it or drafts a reply. Set a filter on which messages trigger the agent, such as one label or one sender, or every message in the inbox will start a run. Publish the agent before expecting it to fire: until then it only runs during testing.

What you need

  • A Gmail inbox the agent may read
  • A filter for which messages trigger the agent, for example one label
  • One test email with a known subject to send

Step 1: Add the new-email trigger with a filter

In the agent’s Trigger section, select Gmail and the new-email event, then set the filter to the label or sender you want. An unfiltered trigger fires on every message.

Step 2: Tell the agent what to do with the message

Write into the instructions what the agent should do with each message: classify it, draft a reply, or route it, and which data to use. The agent receives the message data when the trigger fires.

Step 3: Send the test email and check the run

Send the test email and confirm the agent runs once for it, reads the right subject and body, and does the right thing. If it runs for other mail too, the filter is too broad.

Worked example: synthetic email trigger

The table below is a synthetic example. It shows the expected result of the email trigger; no email was sent.

Check Expected Result
Agent runs on the test email Yes, once Pass
Reads the right subject Yes Pass
Classifies it correctly Yes Pass
No run for other mail 0 runs Pass

Expected result (UNTESTED). the agent runs once for the test email, reads it correctly, and does not run for other mail. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • An unfiltered trigger fires on every message, including newsletters and spam.
  • The agent only sees the messages the trigger sends; older mail is not re-processed.
  • Until you publish, the trigger is inactive and the agent only runs during testing.
  • A reply drafted by the agent still needs a human check before it is sent.

Sources

See all