anaksor-ocr
Sokheng · Kit
Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…
An n8n workflow that labels each new Gmail email with an AI agent. The agent reads the email and your labels, adds the best one, and creates a new label when none fits.
Gmail agent that picks or creates labels with OpenAI is an n8n workflow in the Productivity category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.
New email in Gmail
It checks Gmail every 5 minutes and runs for each new email, with nothing for you to fill in:
The new email carries the best label, and your label list may gain a new one
What you need before you start.
Triggers on each new email, and gives the agent tools to read labels, read a message, create a label and add a label.
NeedsA Gmail OAuth2 credential
Language model
Runs the agent on gpt-5.6-terra, which decides which Gmail tool to call.
NeedsAn OpenAI API key
Checked by Mindket on 13 Nov 2026
This n8n workflow labels every new Gmail email with an AI agent. The agent reads the email, looks at the labels you already have and adds the best one. If none fits, it creates a new label, as a sub label of an existing one when it can. Nine nodes do the work, beside four sticky notes.
People whose Gmail labels grow over time and who want the labelling done for them, new labels included. Skip it if you want a fixed list of labels, since this agent may create new ones.
| Industry | Who uses it | How they use it | Example |
|---|---|---|---|
| Consulting | Independent consultants | Keep client mail under client labels | A consultant sees a message from a new client filed under a new sub label of Clients. |
| Retail | Shop owners | Sort supplier and customer mail as it arrives | An owner sees a supplier invoice land under the Suppliers label. |
| Projects | Project managers | File mail under the project it belongs to | A manager sees a status update carry the label of its project. |
| Personal | Busy individuals | Tidy a mixed inbox without writing filters | A user sees travel mail filed under Travel with no filter rule. |
You need a little n8n: import a file, add two credentials and keep a few labels in Gmail for the agent to follow.
Any n8n that can reach Gmail and OpenAI will run it. It works on mail as it arrives, so you do not need to open n8n.
Download saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. A few existing labels help, because the agent copies their style.
| Need | Detail |
|---|---|
| n8n | On n8n Cloud or on a server of your own |
| Gmail | A Gmail OAuth2 credential, and a few labels for the agent to follow |
| OpenAI | An API key, for an OpenAI credential |
workflow.json.Gmail Trigger and in the four tools, which are Gmail read labels, Gmail get message, Gmail add label to message and Gmail create label.OpenAI Chat Model.Gmail labelling agent and adjust it to your labels.Once it is on, new email is labelled within about five minutes. Open Gmail to see the label on each message. The agent can also create a label, so a new one may appear in your label list. It never sends or deletes mail.
| To change | Where |
|---|---|
| How the agent chooses | System Message in Gmail labelling agent |
| How often it checks | Poll Times in Gmail Trigger |
| Which mail it checks | Filters in Gmail Trigger |
| How many steps it may take | Max Iterations in Gmail labelling agent, which is 5 |
| The model | Model in OpenAI Chat Model |
A consultant receives a message from a new client about a project kickoff. The agent reads your label list and finds a Clients label, but nothing for this client.
It creates a sub label under Clients for the new client and adds it to the message. When the next message from that client arrives, the agent finds the label and reuses it.
If you are new. An agent is an AI that can use tools. Here the tools are four Gmail actions, and the agent decides which to use and in what order. A Gmail label is a tag you can filter on.
For experts. The trigger item goes to the agent as JSON, and the agent reads the message itself through Gmail get message. Window Buffer Memory uses the email id as its session key, so each email has its own short memory.
| Node | What it does | What to know |
|---|---|---|
Gmail Trigger | Gmail Trigger 1.2, polls every 5 minutes | It has no filters, so every new email counts |
Wait | Wait 1.1, amount 1 | The unit is seconds by default, so it pauses for one second |
Gmail labelling agent | Agent 1.7 as a Tools Agent | Max Iterations is 5, and the prompt is the trigger item as JSON |
Window Buffer Memory | Buffer Window Memory 1.3 with a custom key | The key is the email id |
Gmail read labels | Gmail tool 2.1, Get Many labels | It lists every label |
Gmail get message | Gmail tool 2.1, Get | The agent supplies the message id with $fromAI |
Gmail create label | Gmail tool 2.1, Create label | Its description says to use it only when no label exists |
Gmail add label to message | Gmail tool 2.1, Add Labels | The agent supplies the message id and the label ids |
The original named no model, and its prompt asked for something no tool could do.
gpt-5-mini, that default, as shutting down on 11 December 2026 with gpt-5.6-terra as the replacement. Mindket’s copy sets gpt-5.6-terra, which supports function calling, and leaves out the original’s limit of 4,096 output tokensAn n8n workflow that labels every new Gmail email with an AI agent. The agent reads the email and your existing labels, then adds the
best one or creates a new one.
workflow.json: the workflow as n8n exports it, nine working nodes and four sticky notes. It holds no credential.README.md: these notes.gpt-5.6-terra in OpenAI Chat Model andGmail read labels, Gmail get message,Gmail add label to message and Gmail create label.workflow.json.Gmail Trigger and in the four Gmail tools.OpenAI Chat Model.Gmail labelling agent and adjust it to your labels.Gmail Trigger finds a new email, and Wait pauses for one second.Gmail labelling agent receives the email details as JSON and a system message with the labelling rules.Gmail read labels and Gmail get message to learn the labels and the content.Gmail create label, then Gmail add label to message puts the label on the email.Window Buffer Memory keeps the steps of that email, and the agent stops after 5 steps at most.Gmail labelling agent.Gmail Trigger.Gmail Trigger.Gmail labelling agent.OpenAI Chat Model.gpt-5-mini, the default the original relied on, as shutting downgpt-5.6-terra as the replacement. The agent calls tools, so Mindket's copy uses gpt-5.6-terra.NOTICE.md 673 B README.md 3 KB workflow.json 10 KB
Sokheng · Kit
Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…
Qwen · Kit
Qwen2.5-7B-Instruct as GGUF files in eight quantization sizes, to chat with locally through llama.cpp. For people who want a capable 7.6B model on their own co…
ACE-Step · Kit
Generates music from text with a 4B diffusion decoder, 50 steps and guidance control, aiming for higher audio quality than the base. For creators with a GPU of…
op7418 · Skill
Skill that makes single-file HTML slide decks, slide illustrations and platform covers in two visual styles, with a presenter mode for rehearsal. For speakers…
zarazhangrui · Skill
Builds HTML presentations from scratch or from a PowerPoint file and shows visual style previews to pick from, for people who want web slides with no CSS or Ja…
iptv-org · Kit
Collects publicly available live TV channels from many countries into playlists that any video player with live streaming can open. Made for viewers and for de…