The Toolkit take
Your key or Gateway credits
n8n runs AI on your own provider key on any plan, or on Gateway credits on Cloud Starter/Pro without provider accounts (not on Enterprise or self-hosted).
AI-Agent node
Reasons, uses tools, loops — built on LangChain
8 vector stores
Native vector stores: Pinecone, Qdrant, Supabase, Weaviate, Milvus, Zep, MongoDB Atlas, PGVector
Your key or Gateway credits
Own key on any plan; Gateway credits (OpenAI, Anthropic, Gemini, Qwen, MiniMax, Kimi) on Cloud Starter/Pro

Why n8n for AI

Most automation tools bolt on a single LLM action: send text, get text back. n8n treats AI as a first-class framework. Its AI-Agent node, built on a deeply integrated LangChain foundation, lets you assemble an agent that reasons about a goal, uses tools (any of your other nodes, an HTTP call, a database query, even another workflow) to gather what it needs, and loops until it's done, all on the visual canvas, with a code node available wherever you need finer control. Around it sit the pieces serious AI needs: embedding nodes, memory, output parsers, and native vector stores. n8n lists Pinecone, Qdrant, Supabase, Weaviate, Milvus, Zep, MongoDB Atlas and Postgres PGVector[1].

Two design choices matter. First, the model: you can bring your own key on every plan and edition (OpenAI, Anthropic, an open-weight model, even one you host yourself) or, on Cloud Starter and Pro, use Gateway credits to run models from OpenAI, Anthropic, Google Gemini, Qwen, MiniMax and Kimi without provider accounts or API keys[2]. Gateway credits aren't on Enterprise or self-hosted. Second, self-hosting: if you self-host both n8n and the model (for example with Ollama), the pipeline and its data can stay on your own infrastructure. With an external model provider, your prompts go to that provider. n8n Cloud instances are hosted on Azure in the EU (Frankfurt); AI features such as the Assistant and Gateway credits use sub-processors that process data in the US.

The building blocks

Before the playbooks, the vocabulary you'll use:

💡
Toolkit tip
Use a retriever, don't stuff the prompt

For questions over your documents, embed them into a vector store and attach it to the AI-Agent node as a retriever tool. Similarity search over chunks is cheaper and more accurate than dumping whole documents into the context — and it lets you return citations.

Choosing your vector store

RAG lives or dies on the vector store. n8n has eight native options; three cover most stacks, and the right one depends on yours:

Weaviate, Milvus, Zep and MongoDB Atlas are native too, and n8n 2.23 added an Oracle DB Vector Store node. The rule of thumb: self-hosting n8n for privacy? Pair it with a store you host and a local model. Want the least setup? A managed store. A vector store attaches to an agent the same way, as a retriever tool.

Playbook 1 — a RAG knowledge assistant with citations

This is the highest-value AI build for most businesses: employees ask a question and get an answer grounded in your documents, with citations, not a confident hallucination. In n8n it's two workflows.

The ingestion workflow (run when documents change):

  1. Trigger on a document source, e.g. a Google Drive folder.
  2. Split each document into chunks with a text-splitter. Chunk size and overlap matter: too large and retrieval is vague, too small and it loses context. A few hundred tokens with modest overlap is a sane starting point.
  3. Embed the chunks with your embedding model.
  4. Write the vectors to your store.

The query workflow (run when someone asks):

  1. Trigger: a Slack message, chat input or webhook.
  2. AI-Agent node with the vector store attached as a retriever tool: it runs a similarity search, pulls the most relevant chunks, and answers from them.
  3. Output parser to extract citation IDs, so the reply says where the answer came from.
  4. Respond with the answer and its sources.

The result is an internal assistant that answers from your wikis and policies with receipts. The same pattern serves knowledge assistants, compliance checks and contract review. Re-run ingestion on a schedule or on file changes so the knowledge stays current.

⚠️
Watch out
Budget two meters for AI workflows

AI costs two meters: n8n executions plus either your own provider's bill or Gateway credits (Cloud Starter/Pro, prepaid; at zero, nodes using them stop working). Assistant credits are a third, separate allowance, cut on 1 Oct 2026 — see the pricing guide at /articles/n8n-pricing. An agent that loops many times per run can make the model bill the larger one, so cap iterations and match cheap models to simple jobs.

Curious how n8n feels in practice?Free 14-day trial of n8n Cloud, no credit cardStart free trial →

Playbook 2 — a tool-using agent that acts

RAG answers questions; a tool-using agent does things. Give the agent a goal and a toolbox, and it chooses which tool to call.

Example: lead enrichment and first touch. The agent receives a new lead, uses an HTTP tool to look up the company, a search tool for context, scores intent, drafts a tailored opener, and calls your CRM node to create the contact and task. Example: support triage. The agent reads a ticket, classifies it, checks the knowledge base (a retriever tool), then either drafts a grounded reply, escalates to a human, or opens an issue in your tracker.

A powerful n8n-specific move: expose an entire workflow as a tool. Build a reliable "create invoice" or "look up order" workflow once, then hand it to the agent as a single tool. The agent gets a tested, deterministic capability instead of improvising the steps. For multi-agent setups, a coordinator delegates to specialists for research, drafting or validation: inside workflows, each specialist is its own workflow; with n8n Agents, sub-agents are built in. n8n Agents can also connect to Slack, Telegram, Linear or Discord, run on a schedule (always the published version), and be called from workflows. One agent turn counts as one execution. Sub-agent and workflow-tool calls add nothing. On self-hosted, queue mode isn't supported for agents yet.

MCP widens the toolbox both ways. The MCP Client Tool node lets an agent call external MCP servers, and a one-click registry connects servers to an agent. The MCP Server Trigger node turns one workflow into its own MCP server. A built-in instance-level MCP server, on every plan and edition, lets Claude, ChatGPT or Cursor build, edit and run workflows. From n8n 2.35 an MCP client can run an n8n agent through it.

Playbook 3 — the deterministic AI-in-the-loop workflow

Not everything needs an autonomous agent. Often the safest, cheapest pattern is a fixed workflow with one AI step doing the judgment: trigger → free filter to drop noise → AI node classifies or extracts → a switch routes on the result → deterministic actions run. You get AI where it adds value (the judgment) and predictable, debuggable logic everywhere else. Start here for anything consequential. Graduate to full agents only when the task genuinely needs open-ended tool use.

💡
Toolkit tip
Start deterministic, graduate to agents

For anything consequential, begin with a fixed workflow that uses one AI step for the judgment and deterministic logic everywhere else. Move to a fully autonomous, tool-using agent only when the task genuinely needs open-ended decisions — it's cheaper, safer and easier to debug.

Conversational agents and memory

If you're building a chatbot (a Slack assistant, a support bot, an internal helper), the agent needs to remember the conversation. n8n's memory attaches to the AI-Agent node so it carries context across turns. Simple Memory keeps recent exchanges, and you can back memory with an external store (Postgres Chat Memory, Redis Chat Memory, Zep and others) so it survives restarts. Pair memory with a chat trigger and a retriever tool and you have a grounded, stateful assistant. That is the difference between a bot that forgets your last message and one that actually holds a conversation.

Choosing (and paying for) the model

Model choice is yours, and so is the bill, whether it comes from your provider or from Gateway credits. Practical guidance:

Ready to put n8n to the test?Free 14-day trial of n8n Cloud, no credit cardStart free trial →

Guardrails that keep it safe

AI that acts needs boundaries. Six habits, all straightforward in n8n:

  1. Strip sensitive data before the model. Use a code node to remove PII or secrets from anything sent to an external model, or self-host the model so nothing leaves. n8n says it won't train ML models on customer content; it may use de-identified usage data and prompts to improve its AI services.
  2. Keep a human on consequential actions. Since n8n 2.6 (Jan 2026), you can mark tools on the AI Agent as needing approval: a gated tool can't run until a person approves it[4]. Approvals can arrive in n8n Chat, Slack, Teams, Telegram or Gmail, even in a different channel from the conversation. n8n Agents can require approval on sensitive tools too.
  3. Constrain the tools. An agent can only do what its tools allow. Give it the minimum, and prefer read-only tools until you trust it.
  4. Cap iterations. Limit agent steps and set timeouts so a confused agent can't loop indefinitely and run up the model bill. On Cloud, an execution stops at 5 minutes on Starter and 40 on Pro.
  5. Force structure. Use an output parser to require JSON, and validate it before downstream nodes act. Models drift, and a schema catches it.
  6. Log everything. Record what the agent decided and did, so an odd result weeks later is traceable. Start agents on low-stakes, reversible tasks and widen autonomy as trust builds.

Testing and evaluating your AI

AI workflows are non-deterministic, so treat testing differently from ordinary automations. Keep a set of pinned test inputs (real examples with known good outputs) and run them after any change to the prompt, model or tools. n8n builds this in as Evaluations: light evaluations, on small hand-made datasets before deployment, run on all Cloud plans and self-hosted Registered Community, Business and Enterprise; metric-based evaluations run on Cloud Pro and Enterprise, with Starter limited to one workflow. The execution view shows exactly what each node received and returned, including why the agent chose a tool. When you switch models to save cost, re-run the same test set and compare. A cheaper model that passes your cases is free money. One that quietly fails them is a false economy.

Common mistakes to avoid

Putting the AI step inside a loop unnecessarily. Calling the model per item in a 100-item loop is 100 calls and 100 charges. Batch the work or enrich outside the loop where you can. Skipping retrieval and stuffing the prompt. Dumping whole documents into the context is expensive and less accurate than a proper vector-store retriever. Trusting output shape. Use an output parser and validate before downstream nodes act. No human gate on the first deploy. Ship the review step first; remove it only once the agent has earned trust on real traffic. Ignoring chunking. Bad chunk sizes are the most common reason a RAG assistant gives vague answers. Tune them before blaming the model.

Frequently asked questions

Does n8n have AI capabilities?+

Yes. n8n has the LangChain-based AI Agent node, standalone n8n Agents (in Preview since n8n 2.40, on all plans) and n8n Assistant, a Preview chat agent that builds, runs, tests and fixes workflows. On Cloud the Assistant uses a separate monthly allowance of Assistant credits (Starter 1,600, Pro up to 9,600 since 1 Oct 2026); on self-hosted it runs on your own provider key, and on Enterprise it is available on request.

What can I build with AI in n8n?+

AI agents that take actions across your apps, RAG-style workflows that answer from your own data, classification and routing of incoming items, summarization and extraction, and content drafting for review. n8n's code nodes and self-hosting make it especially flexible for custom, data-sensitive AI builds.

How do I add an LLM like OpenAI to an n8n workflow?+

Add the relevant AI/LangChain node or the provider's node, connect your API key — or, on n8n Cloud Starter and Pro, use Gateway credits without a provider account — and pass data from earlier nodes into the prompt. For example, feed an incoming message into an AI node that classifies it, then branch on the result.

What does AI cost in n8n?+

On Cloud each workflow run counts as an execution; the free self-hosted Community Edition has no execution quota, while a self-hosted Business licence counts executions (40,000 a month). Model usage is billed either by your own provider or, on Cloud Starter and Pro, from prepaid Gateway credits, and n8n Assistant draws on a separate Assistant-credit allowance.

Why do developers prefer n8n for AI automation?+

Because it combines visual AI/agent nodes with self-hosting (keep data on your own infrastructure when the model is self-hosted too), code nodes (shape prompts, parse outputs, add custom logic) and execution-based pricing that doesn't charge per step, with no execution quota on the free self-hosted Community Edition.

What this solves

n8n's visual editor, native/custom nodes, triggers, and data-logic tools are built precisely to automate multi-step processes across tools.

Every n8n plan includes unlimited users (since August 2025), so colleagues can join without a team plan; Starter has 1 shared project and Pro 3.

The bottom line

n8n's AI is a genuine reason to choose it: an agent framework with LangChain, standalone n8n Agents in Preview, native RAG across eight vector stores, tool-using and multi-agent patterns, MCP both ways, human approval for tool calls, built-in evaluations, and the choice of your own key or Gateway credits, with the option to self-host n8n and the model. Start with a deterministic AI-in-the-loop workflow, add RAG when you need grounded answers, layer in memory for conversation, and graduate to autonomous, tool-using agents with tight guardrails once you trust the pattern. For the full evaluation, see our n8n review; to understand what it costs, the pricing guide covers n8n executions, credits and the separate model bill.

Sources
  1. [1] n8n — RAG and native vector stores (2026-10) https://n8n.io/rag/
  2. [2] n8n docs — Gateway credits (2026-10) https://docs.n8n.io/deploy/use-n8n-cloud/gateway-credits.md
  3. [3] n8n docs — build and manage agents (2026-10) https://docs.n8n.io/build/build-and-manage-agents.md
  4. [4] n8n docs — human-in-the-loop for AI tools (2026-10) https://docs.n8n.io/build/integrate-ai/ai-examples/human-in-the-loop-for-tools.md