Inbox assistant AI agent

Reads each new email and decides: draft a reply, create a task, alert you — or ignore it.

AI agentMedium Saves ~20 hours/month AI AgentsBy Flowngn team

Works with n8n · Make · Zapier

How it works

Trigger: Gmail — new unread email in your primary inbox
  1. A new email arrives.
  2. The agent decides what it needs: a reply, a task, an urgent alert, or nothing.
  3. It drafts replies in the same thread, creates Notion tasks with due dates, and alerts you on Slack.
  4. You review the drafts and hit send.

What it can do

Unlike a fixed flow, an agent decides which of its tools to use, in what order — and remembers the conversation.

  • Ignores newsletters and notifications
  • Drafts replies in the sender's language, in the same thread
  • Turns requests and deadlines into Notion tasks
  • Alerts you on Slack about urgent emails

System prompt

The instructions that shape the agent. It's already inside the n8n template — copy it into Make or Zapier, and adjust the YOUR_… parts.

System prompt
You are an email assistant for YOUR_NAME. For each new email, decide what to do and use your tools. You NEVER send emails, you only draft them.

Decide:
1. Newsletter, notification or marketing → do nothing.
2. Needs a reply → use "Draft reply" with a short, polite reply in the sender's language. Use [brackets] for anything YOUR_NAME must fill in. Never invent facts, prices or commitments.
3. Contains a task or deadline for YOUR_NAME → use "Create task" with a clear title and the due date if one is mentioned.
4. Urgent (a client problem, a payment issue, a same-day deadline) → use "Alert me" with a one-line summary.

An email can need several actions. Finish with a one-line summary of what you did.

Safety rules

Built into the prompt and the tools:

  • Never sends email — it only creates drafts
  • Never invents facts, prices or commitments; uses [brackets] for you to fill in

Uses your own AI key (Claude, OpenAI or another model). Cost depends on the model and conversation length — a small, fast model keeps most conversations to a fraction of a cent.

Diagram

GNew emailGmail TriggerInbox agentAI AgentClaude modelAnthropic Chat Mo…◷MemorySimple MemoryGDraft replyGmail ToolNCreate taskNotion ToolSAlert meSlack Tool
Trigger AI Agent tool

Build it

Pick your tool — same automation, step by step.

Copy and paste straight into an n8n canvas (Ctrl+V), or download and use Import from File. Then connect your own credentials and replace every YOUR_… placeholder. AI steps use a Claude model node — swap it for OpenAI, Gemini or Ollama if you prefer.

Workflow JSON
Show code (247 lines)
{
  "name": "Inbox assistant AI agent (Flowngn)",
  "nodes": [
    {
      "parameters": {
        "content": "## Inbox assistant AI agent\nReads each new email and decides: draft a reply, create a task, alert you — or ignore it.\n\n**Setup**\n1. Open each node and connect your own credentials.\n2. Replace every YOUR_… placeholder.\n3. Test once, then activate.\n\nFree template from Flowngn",
        "height": 260,
        "width": 340
      },
      "id": "35c47c31-b9cf-4487-a721-f2e9d58ac8d0",
      "name": "Setup notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -420,
        -60
      ]
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyX",
              "value": 5,
              "unit": "minutes"
            }
          ]
        },
        "simple": false,
        "filters": {
          "q": "category:primary is:unread"
        },
        "options": {}
      },
      "id": "35c47c31-b9cf-4487-a721-f2e9d58ac8d0",
      "name": "New email",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=From: {{ $json.from.text }}\nSubject: {{ $json.subject }}\nDate: {{ $json.date }}\n\n{{ ($json.text || '').slice(0, 6000) }}",
        "options": {
          "systemMessage": "=You are an email assistant for YOUR_NAME. For each new email, decide what to do and use your tools. You NEVER send emails, you only draft them.\n\nDecide:\n1. Newsletter, notification or marketing → do nothing.\n2. Needs a reply → use \"Draft reply\" with a short, polite reply in the sender's language. Use [brackets] for anything YOUR_NAME must fill in. Never invent facts, prices or commitments.\n3. Contains a task or deadline for YOUR_NAME → use \"Create task\" with a clear title and the due date if one is mentioned.\n4. Urgent (a client problem, a payment issue, a same-day deadline) → use \"Alert me\" with a one-line summary.\n\nAn email can need several actions. Finish with a one-line summary of what you did."
        }
      },
      "id": "35c47c31-b9cf-4487-a721-f2e9d58ac8d0",
      "name": "Inbox agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.9,
      "position": [
        300,
        0
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "claude-sonnet-5",
          "mode": "list"
        },
        "options": {}
      },
      "id": "35c47c31-b9cf-4487-a721-f2e9d58ac8d0",
      "name": "Claude model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        -40,
        220
      ]
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.threadId }}",
        "contextWindowLength": 10
      },
      "id": "35c47c31-b9cf-4487-a721-f2e9d58ac8d0",
      "name": "Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        130,
        220
      ]
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Saves a reply as a Gmail draft in the same thread. It is never sent automatically.",
        "resource": "draft",
        "operation": "create",
        "subject": "=Re: {{ $('New email').item.json.subject }}",
        "message": "={{ $fromAI('reply', \"The full reply text\", 'string') }}",
        "options": {
          "threadId": "={{ $('New email').item.json.threadId }}",
          "sendTo": "={{ $('New email').item.json.from.value[0].address }}"
        }
      },
      "id": "35c47c31-b9cf-4487-a721-f2e9d58ac8d0",
      "name": "Draft reply",
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [
        300,
        220
      ]
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Creates a task in the Notion tasks database.",
        "resource": "databasePage",
        "operation": "create",
        "databaseId": {
          "__rl": true,
          "value": "YOUR_TASKS_DATABASE_ID",
          "mode": "id"
        },
        "title": "={{ $fromAI('task', \"Clear, short task title\", 'string') }}",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Due|date",
              "date": "={{ $fromAI('due', \"Due date YYYY-MM-DD, or empty if none\", 'string') }}"
            }
          ]
        },
        "options": {}
      },
      "id": "35c47c31-b9cf-4487-a721-f2e9d58ac8d0",
      "name": "Create task",
      "type": "n8n-nodes-base.notionTool",
      "typeVersion": 2.2,
      "position": [
        470,
        220
      ]
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Sends an urgent one-line alert to Slack.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "#inbox-alerts",
          "mode": "name"
        },
        "text": "={{ $fromAI('alert', \"One-line summary of what is urgent and why\", 'string') }}",
        "otherOptions": {}
      },
      "id": "35c47c31-b9cf-4487-a721-f2e9d58ac8d0",
      "name": "Alert me",
      "type": "n8n-nodes-base.slackTool",
      "typeVersion": 2.2,
      "position": [
        640,
        220
      ]
    }
  ],
  "connections": {
    "New email": {
      "main": [
        [
          {
            "node": "Inbox agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude model": {
      "ai_languageModel": [
        [
          {
            "node": "Inbox agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Memory": {
      "ai_memory": [
        [
          {
            "node": "Inbox agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Draft reply": {
      "ai_tool": [
        [
          {
            "node": "Inbox agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create task": {
      "ai_tool": [
        [
          {
            "node": "Inbox agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Alert me": {
      "ai_tool": [
        [
          {
            "node": "Inbox agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}

Open in the playground to edit →

Tips

  • Run it on a test label for a week before pointing it at your whole inbox.

Related flows