n8n Flow
Email Triage
Two-pass AI triage for the inbox: a fast first pass labels the confident emails, and anything uncertain gets a deeper second pass on the full body.
A work in progress
We've published these resources in the hope they're useful — you're welcome to copy or use anything you find on this site. We're still working through each record to optimise it for completeness and accuracy, so some entries are fuller than others for now.
The full workflow as it runs in n8n. Drag to pan, zoom with the controls, and hover any step for what it does.
Drag to pan · zoom with the controls · hover a step for detail.
- Gmail Trigger (trigger): Fires when a new email arrives. → Extract Metadata.
- Extract Metadata (action): Pulls out sender, subject, and snippet. → Langfuse Pass 1.
- Langfuse Pass 1 (ai): Loads the first-pass prompt. → Compile Pass 1.
- Compile Pass 1 (action): Fills the prompt with the email metadata. → AI Agent.
- AI Agent (ai): Classifies the email from its metadata. → Confident Pass 1?.
- Haiku Pass 1 (ai): The fast model behind pass one. → AI Agent.
- Output Schema Pass 1 (ai): Forces a structured result. → AI Agent.
- Anthropic Chat Model (ai): Model that powers the pass-one parser. → Output Schema Pass 1.
- Confident Pass 1? (logic): Branches on whether pass one was confident. → Map Label Pass 1. → Fetch Full Body.
- Map Label Pass 1 (action): Chooses the Gmail label. → Apply Label Pass 1.
- Apply Label Pass 1 (action): Labels the email.
- Fetch Full Body (action): Pulls the full email body for a closer look. → Truncate Body.
- Truncate Body (action): Trims the body to a safe length. → Langfuse Pass 2.
- Langfuse Pass 2 (ai): Loads the deeper second-pass prompt. → Compile Pass 2.
- Compile Pass 2 (action): Fills the second-pass prompt. → AI Agent Pass 2.
- AI Agent Pass 2 (ai): Re-classifies using the full body. → Parse Pass 2.
- Haiku Pass 2 (ai): The model behind pass two. → AI Agent Pass 2.
- Output Schema Pass 2 (ai): Structured result for pass two. → AI Agent Pass 2.
- Anthropic Chat Model1 (ai): Model that powers the pass-two parser. → Output Schema Pass 2.
- Parse Pass 2 (action): Reads the second-pass decision. → Apply Label Pass 2.
- Apply Label Pass 2 (action): Applies the final label.
Ready to build technology that works for your mission?
Tell us where your organisation is and what's slowing your team down. We respond personally.