Skip to content
Back to Blog
n8n·12 min read

Build AI Workflows in n8n: Patterns That Work in Production

Six AI workflow patterns we build in n8n, with the current node names, model choices and the checks that keep them reliable once real data arrives.

By Matthew Clarkson · August 11, 2024 · Updated November 17, 2026

AI workflows in n8n

When we started building AI workflows in n8n, most of it was HTTP Request nodes calling the OpenAI API by hand. n8n now has dedicated nodes for most of that work: an AI Agent node that calls tools, nodes for classification and extraction, vector stores, chat memory, human approval on tool calls and built-in evaluations.

We are a Brisbane AI consultancy and run self-hosted n8n for clients. This is the short list of patterns we keep coming back to, updated in November 2026 for n8n 2.x. If you are new to agents, read what an AI agent is first.

What counts as an AI workflow

An AI workflow is an ordinary n8n workflow where one or more steps call a language model. The model handles the judgement a rule can't, such as working out what kind of email just arrived. Everything around it stays deterministic: triggers, validation, routing and writes to your systems.

Almost everything we build is one of the six patterns below, or two of them joined together.

Pattern 1: Classify and route

Something arrives (an email, a form, a document, a support ticket). A model decides what it is. The workflow sends it to the right place.

Trigger (Email / Webhook / Schedule)
  -> Extract From File (if it's a PDF)
  -> Text Classifier
  -> one output branch per category, plus "Other"

Use the Text Classifier node for this. You give it a list of categories, each with a short description, and it returns one output branch per category. The descriptions do most of the work, so write them as you would for a new staff member: what belongs in this category and what doesn't.

Set "When No Clear Match" to send items to the Other branch and route that branch to a person. Don't ask the model for a confidence score and set a threshold on it. Self-reported confidence is not reliable. An explicit "none of these" branch works better.

Classification is a good job for the cheapest model tier. See the model section below.

Pattern 2: Extract and validate

Pull structured fields out of unstructured text or images, check them, then write them to a system.

Trigger (Folder / Email)
  -> Extract From File, or pass the image to a vision-capable model
  -> Information Extractor (JSON schema)
  -> Code (validate)
  -> If valid: write to the accounting system / CRM
     If not: review queue

The Information Extractor node takes a JSON schema, a JSON example or a list of attributes, and returns fields in that shape. That gets you well-formed output. Whether the values are right is a separate check.

The validation step is where these workflows succeed or fail. Models misread digits, swap date formats and return line items that don't add up. For an Australian invoice, the checks we run in a Code node after the model include:

  • the ABN passes its checksum, and an ABN Lookup call confirms it is active and matches the supplier name
  • line items add up to the subtotal, and subtotal plus GST equals the total
  • the date is a real date in the expected range

Anything that fails goes to a review queue, never straight into Xero or the source system. Plan for human review from day one. The share of documents that need it falls over time but rarely reaches zero.

Pattern 3: An agent with tools

The AI Agent node gives a chat model a set of tools and lets it decide which to call. This is the pattern behind internal assistants and n8n chatbots.

Chat Trigger or Slack Trigger
  -> AI Agent
       chat model: Anthropic or OpenAI Chat Model
       memory: Postgres Chat Memory
       tools: Postgres, Google Calendar, Gmail, HTTP Request, Call n8n Workflow
  -> reply to the user

Since n8n 1.82 the agent always works as a Tools Agent. The old agent types (ReAct, Conversational, Plan and Execute and others) only survive in version 1 of the node, which n8n 3.0 removes.

What we have learned building these:

  • The system prompt matters more than the model. Specific rules ("show me the draft before sending any email", "if two candidates share a name, ask which one by ID") prevent most bad behaviour.
  • Write every tool description by hand. The agent picks tools by their descriptions. Say when to use the tool and what it returns. Vague descriptions are the most common reason an agent calls the wrong tool.
  • Use $fromAI() for the tool parameters the model should fill in, and fix the rest. An agent that can only choose the date range is safer than one that can write any query.
  • Use Simple Memory only for testing. It is not reliable in queue mode. Use Postgres Chat Memory or Redis Chat Memory in production.
  • Put human review on risky tools. n8n can require approval before the agent runs a tool. You connect the tool through a human review step in the agent's tools panel and choose where the request goes (Slack, Teams, Gmail, Outlook, Telegram, n8n Chat and others). If the reviewer declines, the agent is told and the action doesn't run. We use this on anything that sends a message, deletes data or spends money.

If the systems you need already have MCP servers, the MCP Client Tool node lets the agent use their tools directly. The MCP Server Trigger does the reverse and exposes n8n workflows as tools to other agents.

Pattern 4: RAG over your own documents

Retrieval-augmented generation answers questions from your own documents. It finds the relevant passages first, then asks the model to answer from those passages only. Our RAG explainer covers the idea. In n8n it takes two workflows.

# Indexing (scheduled)
Schedule Trigger
  -> list files changed since the last run (Google Drive, SharePoint, S3)
  -> Vector Store node (insert)
       Default Data Loader + text splitter
       Embeddings node

# Answering (on demand)
Chat Trigger or Webhook
  -> AI Agent
       tool: Vector Store node (retrieve as tool)
  -> respond

For the vector store, use PGVector if you already run PostgreSQL. It is one less system to look after. Qdrant is a good self-hosted choice when you need stronger filtering or a large corpus. Pinecone and Supabase are the managed options. n8n 3.0 removes some older separate insert and load nodes, so build with the current Vector Store nodes.

Chunk size depends on the content. Long prose tolerates bigger chunks than policies, contracts or code, where a chunk should hold one clause or one function. Don't guess. Write 20 or so questions you know the answers to and check that the right passages come back. n8n's evaluations (the Evaluation Trigger and Evaluation nodes) let you run that test set against the workflow every time you change it.

Pattern 5: Scheduled research and reports

Run on a schedule, collect information from websites, feeds or internal systems, summarise what changed and send it to a channel. It is unglamorous and often has the best return on build time of the six.

Schedule Trigger (Monday 7am)
  -> read last week's snapshots
  -> Loop Over Items
       HTTP Request
       Code (hash each section, compare with last week)
       only changed sections -> model (summarise)
  -> Aggregate
  -> Slack / email

Do the comparison before the model sees anything. If you send every full page to the model every week, you pay it to summarise things that haven't changed. Hash each section, keep the hashes and only pass on the sections whose hash changed.

Pattern 6: Human in the loop

The model drafts. A person approves. Use this whenever a wrong action costs more than a short delay.

Trigger
  -> AI Agent or Basic LLM Chain (draft)
  -> Slack: Send and Wait for Response (Approval)
  -> If approved: send
     If declined: discard or send back for a rewrite

The Send and Wait for Response operation (on Slack, Microsoft Teams, Outlook, Discord and other nodes) posts the draft with approve and decline buttons and pauses the execution until someone answers. In Slack you can restrict who is allowed to approve and record who did. Set Limit Wait Time and decide what happens to drafts nobody answers, so they don't sit there forever.

Pattern 3's human review on tools does the same job inside an agent. Use this pattern for fixed workflows. Use tool review when an agent decides what to do.

The nodes you will use most

  • Chat model nodes: OpenAI, Anthropic, Google Gemini and others. These connect to the AI nodes below.
  • AI Agent: a model plus tools, memory and an optional output parser.
  • Basic LLM Chain: one prompt, one answer. Use it when you don't need tools.
  • Text Classifier and Information Extractor: purpose-built for patterns 1 and 2.
  • Embeddings and Vector Store nodes: PGVector, Qdrant, Pinecone, Supabase and more.
  • Default Data Loader and a text splitter: turn files into chunks for indexing.
  • Postgres Chat Memory or Redis Chat Memory: conversation history for agents.
  • MCP Client Tool and MCP Server Trigger: use MCP tools, or expose workflows as tools.
  • Code: JavaScript or Python for validation and anything awkward to do visually. In n8n 2.x it runs in a separate task runner.
  • Evaluation Trigger and Evaluation: run test sets against AI workflows.
  • Error Trigger: the start of an error workflow that tells you when something fails.

Choosing a model

As of November 2026 we use:

  • Agents and anything that needs judgement: Claude Sonnet 5.5 or OpenAI's GPT-6.1 Sol. Both list at US$2 per million input tokens and US$10 per million output tokens.
  • High-volume classification, extraction and summaries: Claude Haiku 5.5 or OpenAI's GPT-6 Luna. Both list at US$0.10 per million input tokens and US$0.50 per million output tokens.

Prices and names change often, so check the provider's pricing page before you commit. Start with the cheap tier for patterns 1, 2 and 5 and only move up when testing shows the cheaper model getting it wrong.

Errors and costs

Every production AI workflow needs three layers of error handling:

  1. On nodes that call outside services, use the node's On Error setting. "Continue (using error output)" sends failures down their own branch so one bad item doesn't stop the run. Turn on Retry On Fail for calls that fail now and then, such as rate limits.
  2. Validate model output in a Code node and send anything invalid to review (pattern 2).
  3. Set an error workflow, starting with an Error Trigger, that posts the workflow name, failed node and execution link to Slack or Teams. This is how you find out about a broken workflow the same morning instead of when a user complains.

For costs, the provider dashboards show total spend but not spend per workflow, and per workflow is what you need when one workflow starts burning money. The simplest fix we know is a separate API key (an OpenAI project or an Anthropic workspace) for each workflow or group of workflows, so the provider's own usage reports split the bill for you. A scheduled workflow can pull those reports and post a daily summary.

If you self-host n8n, the platform cost is a fixed server bill and model spend is the variable. Our guide to hosting n8n with Coolify covers the setup we use.

When n8n is the wrong tool

  • High-concurrency public chat. n8n handles a lot of workflow executions, but a public chatbot with thousands of simultaneous users belongs in application code. Our Python agent guide covers that route.
  • Very low latency. Every execution has workflow overhead on top of the model call. For interfaces where every few hundred milliseconds counts, call the model from your app.
  • Complex retrieval. If you need reranking, hybrid search, query rewriting and several retrievers, you will spend more time fighting the vector store nodes than you save. Build that pipeline in code.
  • Strict version control. Git-based source control is a Business and Enterprise feature. On Community Edition you export workflow JSON yourself, and reviewing JSON diffs is unpleasant. If every change needs code review and CI, a code-first agent framework is a better fit.

For most business AI work, which means connecting a model to several business systems with a few rules around it, n8n is what we reach for. The visual canvas also helps when the people who own the process aren't developers.

Frequently asked questions

Should I use the AI Agent node or a fixed chain?

Use a fixed chain (Text Classifier, Information Extractor or Basic LLM Chain, then normal nodes) when the steps are known in advance. Use the AI Agent node when the model has to decide which actions to take. Classification, extraction and summaries are almost always fixed chains. Assistants and research agents need the agent.

Can AI build n8n workflows for me?

Partly. n8n's AI Workflow Builder turns a description into a workflow, using credits that depend on your plan. Like other generators, it gets the obvious nodes right and misses production details such as error handling, validation and rate limits. We treat its output as a first draft.

Which vector store should I use with n8n?

PGVector if you already run PostgreSQL. Qdrant if you want a dedicated self-hosted store with strong filtering. Pinecone or Supabase if you want it managed.

How do I stop an agent doing something it shouldn't?

Limit what each tool can do with fixed parameters, write strict rules in the system prompt and put human review on any tool that sends, deletes or pays for something.

Does this work on self-hosted n8n?

Yes. The nodes and patterns in this article all work on the free self-hosted Community Edition. A few extras are limited by plan: Git source control needs a paid licence, and metric-based evaluations are limited to one workflow on a registered Community Edition. Light evaluations against a small test set work on every plan.

If you want help choosing a pattern or getting the first workflow into production, see our n8n consulting services or book a 15-minute call.

Last updated on November 17, 2026

Free tool · 1 minute

AI Agent Idea Generator

Describe a painful process and get concrete AI agent concepts for your industry.

Continue Reading

View all

Sick of reading about automation?

Book a free 15-minute intro call. We’ll talk through what you’re trying to automate and whether we’re a good fit.