n8n AI Agent: How It Works and How to Automate Workflows with AI
The n8n AI Agent node gives a workflow a language model that can choose its next step: which tool to call, which record to look up, and when to stop. This guide explains how the node works today, which tools, memory and knowledge sources it can use, how to build one step by step, and the controls that keep it safe once it touches your CRM.
Key Takeaways
- The n8n AI agent is a node, not a separate product: an AI Agent root node with a chat model, optional memory and at least one tool attached, which decides which tool to call to finish a task.
- Every current AI Agent node works as a Tools Agent. The older agent types (Conversational, ReAct, SQL and others) were deprecated in n8n 1.82.0 and are removed in n8n 3.0.
- Tools can be any app node, including Salesforce and HubSpot, plus HTTP requests, code, other n8n workflows, vector stores for RAG, other agents and external MCP servers.
- Production agents need controls: human approval for risky tool calls, the Guardrails node, evaluations, an error workflow and scoped credentials.
- n8n is fair-code, not open source. You can self-host the Community edition free for internal use, or pay for n8n Cloud, where pricing is per workflow execution.
What is the n8n AI agent? It is the AI Agent node in n8n, the workflow automation platform. You connect a chat model, such as an OpenAI, Anthropic or Google model, and one or more tools. When the workflow runs, the model reads the input, decides which tools to call and in what order, checks the results and returns an answer or takes an action. It is how n8n adds reasoning to an otherwise fixed automation.
We first published this post in March 2025. This version is rebuilt from n8n's current documentation, checked in October 2026, and it corrects several points that have changed or were never right: n8n's licence, the retired agent types and the unsourced results in the old case examples. It is written for operations, RevOps and IT leaders at growing and mid-market companies who want AI agents to do real work across their CRM and business systems, and for the admins who will build and run them. If you are new to n8n itself, start with our general n8n guide.
What Is the n8n AI Agent Node?
The AI Agent node is a root node with sub-nodes plugged into it. n8n builds its AI features on LangChain's JavaScript framework and represents them as "cluster nodes": the root node defines what the cluster does, and the sub-nodes supply the model, memory and tools. The AI Agent node documentation requires a chat model and at least one tool.
Chat model
The reasoning engine. n8n ships model sub-nodes for OpenAI, Anthropic, Groq, Mistral, Ollama and others, and one workflow can mix several models.
Memory
Keeps earlier messages so a conversation has context. Simple Memory suits testing; Postgres or Redis Chat Memory keeps history in a database you control.
Tools
The actions the agent may take: app nodes such as Salesforce or HubSpot, HTTP requests, code, other workflows, vector stores and MCP servers.
Output parser
Optional. Forces the answer into a fixed structure, such as JSON with named fields, so the next node can use it without guesswork.
One distinction matters from the start. n8n also has chains, such as the Basic LLM Chain and Summarization Chain. A chain runs a fixed sequence: prompt in, answer out. An agent uses the model to decide which actions to take. n8n's documentation adds that memory attaches only to the AI Agent node, so a workflow that must remember a conversation needs an agent, not a chain.
How Does an n8n AI Agent Work?
An n8n AI agent runs as a loop inside an ordinary workflow. A trigger starts the run, the agent sends the input and its instructions to the chat model, the model asks for a tool, n8n runs that tool and returns the result, and the model decides whether to call another tool or answer. The final output then flows to the next node like any other data.
Something starts the workflow
A Chat Trigger for a chatbot, a webhook, a schedule, a form, or an app trigger such as a new Salesforce lead or HubSpot ticket.
The agent plans with the model
The system message sets the role, rules and limits. The model reads the input and the tool descriptions and chooses what to do next.
Tools run, results return
n8n executes the chosen tool and hands the result back. The model may call more tools. The loop stops at an answer or at Max Iterations, which defaults to 10.
The output moves on
The answer goes back to the chat, or onward to update a record, post to Slack, send an email or start another workflow, with logs in the execution history.
Two settings shape this loop. Max Iterations caps how many times the model can go round before n8n stops it, which protects you from an agent that keeps calling tools. Return Intermediate Steps includes each tool call in the output, which is useful for debugging and audit. Streaming is on by default and sends the answer token by token when the trigger supports it, as the Chat Trigger does. The full list is on n8n's Tools Agent page.
What Happened to n8n's Agent Types, and What Is the Tools Agent?
The Tools Agent is now the only way the n8n AI Agent node works. n8n deprecated the agent type setting in version 1.82.0, and every AI Agent node now behaves as a Tools Agent, which uses the model's native tool-calling interface. The old types are removed in n8n 3.0, so workflows built on them need updating.
| Old agent type | Status | What to use instead |
|---|---|---|
| Tools Agent | Current | The default behaviour of every current AI Agent node |
| Conversational Agent | Removed in 3.0 | AI Agent node with a memory sub-node and a Chat Trigger |
| SQL Agent | Removed in 3.0 | AI Agent node with a Postgres or MySQL tool sub-node |
| OpenAI Functions, Plan and Execute, ReAct | Removed in 3.0 | AI Agent node, which already uses tool calling |
n8n 3.0 also removes the separate legacy HTTP Request Tool node (you attach the normal HTTP Request node to the agent's Tool input instead), the Motorhead and Zep memory nodes, and npm-based self-hosting, which gives way to Docker. n8n's 3.0 breaking-changes page lists everything; at the time of writing it described 3.0 as "releasing soon". If your instance still runs agents built in 2024 or early 2025, audit them now.
What Tools Can an n8n AI Agent Use?
An n8n AI agent can use almost any node as a tool. That includes app nodes such as Salesforce, HubSpot, Slack and Gmail, the HTTP Request node for any API, a Code tool, other n8n workflows, vector stores for company knowledge, other AI agents, and external MCP servers. The agent picks a tool by reading each tool's name and description.
| Tool | What it lets the agent do | Typical use |
|---|---|---|
| App nodes (Salesforce, HubSpot and others) | Read and write records through the same node used in normal workflows | Look up an account, create a task, update a deal or ticket |
| HTTP Request | Call any REST API; the tool-only "Optimize Response" option trims what is sent to the model | An internal API, an enrichment service, an endpoint the app node lacks |
| Call n8n Workflow Tool | Run another n8n workflow and use its output | Wrap a tested, multi-step process as one safe action |
| Code Tool | Run JavaScript or Python the builder wrote | Calculations, formatting, validation rules |
| Vector store tools | Search embedded documents (retrieval-augmented generation) | Answer from policies, product docs or contracts |
| AI Agent Tool | Call another agent as a tool, in one or more layers | A coordinator agent with specialist sub-agents |
| MCP Client Tool | Use the tools an external MCP server exposes | Connect a vendor's MCP server without building each action |
Three details make tools reliable. First, the Salesforce node and the HubSpot node are themselves usable as AI tools; there is no separate "Salesforce tool". The Salesforce node covers accounts, contacts, leads, opportunities, cases, tasks, custom objects, SOQL search and invoking Salesforce Flows. Second, the $fromAI() expression lets the model fill a specific parameter, such as an email address or a record ID, while you fix everything else; n8n explains it in letting AI specify tool parameters. Third, when a sub-workflow is called as a tool in production, it must be published, or the call fails.
How Do MCP and RAG Extend an n8n AI Agent?
MCP (Model Context Protocol) and RAG (retrieval-augmented generation) solve different problems. MCP connects an agent to tools that live outside n8n, or exposes n8n workflows as tools to other AI clients. RAG gives the agent your own documents to search, so answers come from your content rather than from the model's general training.
MCP in both directions
The MCP Client Tool lets an n8n agent use tools exposed by an external MCP server, and n8n's node panel now includes a registry of MCP servers you can connect in a few clicks. In the other direction, the MCP Server Trigger turns a workflow into an MCP server, so clients such as Claude Desktop can call the tools you choose. n8n also offers an instance-level MCP server that exposes enabled workflows through one connection. n8n's own guidance is useful here: a built-in node gives tighter control over what the agent can do, while an MCP server gives the agent more freedom at the cost of control and more context per call. For anything that writes to your CRM, we prefer fixed nodes or a published sub-workflow.
RAG with a vector store
A RAG setup has two halves. An ingestion workflow loads documents, splits them into chunks, turns them into embeddings and inserts them into a vector store. The agent then gets the vector store as a tool and searches it when a question needs company knowledge. n8n's Pinecone, Qdrant and Supabase vector store nodes, among others, can each attach to an agent directly as a tool. The Simple Vector Store is for development only: per n8n's documentation, its data is lost on restart and visible to every user on the instance. The pattern is explained in n8n's RAG guide.
How Do You Build an n8n AI Agent?
Build an n8n AI agent in seven steps: pick the trigger, add the AI Agent node, attach a chat model, write a strict system message, add only the tools the job needs, add memory and an output format where useful, then test with real examples before you activate it. The example below triages inbound leads into a CRM.
Scenario: a website form sends new enquiries. The agent should check whether the company already exists in Salesforce or HubSpot, classify the enquiry, create or update the lead, and alert the right team in Slack. Anything unusual goes to a person.
$fromAI() fill only the values the model must choose. Add a Slack tool for alerts.The old version of this post walked through a content workflow: a new row in Google Sheets triggers an OpenAI draft that is saved to Notion or Airtable and sent to Slack for review. That still works, and it is a good first project because a person reviews every output. The lead-triage version above is closer to the work most revenue teams want to automate, and it shows the controls a CRM write needs.
Which Workflows Suit n8n AI Agents?
n8n AI agents suit work where the input is messy, the steps vary case by case, and the actions are small and reversible: reading emails, tickets, forms and documents, deciding what they are, looking things up across systems and preparing an update. Work that follows the same fixed steps every time is usually cheaper and safer as a normal workflow without an agent.
Lead triage and enrichment
Classify enquiries, match them to existing accounts, fill missing fields and route them to the right owner in Salesforce or HubSpot.
Support ticket handling
Read a new ticket, search the knowledge base with RAG, draft a reply for an agent to approve, and set category and priority.
Inbox categorization
Sort shared-inbox email by intent, extract the request, log it against the right CRM record and flag anything urgent.
Document extraction
Pull fields from invoices, orders or contracts, check them against the system of record, and queue mismatches for a person.
Content drafting pipelines
A researcher agent gathers sources, writer and editor steps draft and refine, and the result lands in a document for human review.
Internal knowledge assistant
A chat agent answers staff questions from policies, playbooks and product documentation, with the sources it used.

In each case, start with the agent preparing and a person approving, then remove the approval step for the action types that prove reliable. The same principle shaped an AI automation we built for a US legal technology platform. That project ran inside Salesforce rather than n8n, with OpenAI summarizing inbound email and AWS Textract reading attachments, and it included an error log and an admin switch to pause the AI. See the Salesforce GPT email automation case study for how it was designed.
How Do You Keep an n8n AI Agent Safe and Reliable in Production?
Keep an n8n AI agent safe by limiting what it can do, checking what goes in and out, and watching what it did. In practice that means narrow tools with least-privilege credentials, human approval on risky tool calls, the Guardrails node on inputs and outputs, evaluations before and after launch, and an error workflow that alerts someone when a run fails.
Cost belongs on this list too. On n8n Cloud, each workflow run is one execution, and every message to a Chat Trigger starts a run, so a ten-message conversation uses ten executions. Model provider charges are separate and grow with every tool call and long prompt. Trim tool output with "Optimize Response" and keep system messages tight.
Should You Use n8n Cloud or Self-Host?
Choose n8n Cloud when you want n8n to run the infrastructure and you are comfortable with your data passing through n8n's hosting. Choose self-hosting when data must stay in your own cloud or network, or you need to control scaling and versions, and you have the people to run it. Both are supported for production use.
| Question | n8n Cloud | Self-hosted |
|---|---|---|
| Who runs it | n8n | Your team, on your servers or cloud account (Docker) |
| How you pay | Plans priced on monthly workflow executions, with unlimited steps, users and workflows | Community edition free; Business and Enterprise licences are paid |
| AI Agent, MCP and AI nodes | Included on all plans | AI Agent node in every edition; light evaluations need at least the free Registered Community edition |
| Scaling | Managed by n8n | Queue mode: a main instance hands executions to workers through Redis |
| SSO, custom roles, log streaming | Enterprise plan | SSO from the Business licence; custom roles and log streaming on Enterprise |
The licence needs a precise word. The old version of this post called n8n "open source". n8n itself does not: it describes its model as fair-code, with the Sustainable Use License and the n8n Enterprise License. You may self-host and change n8n for your own internal business use, and a consultant may charge for building and supporting workflows, but you may not offer n8n to clients as a hosted service in which they build their own workflows. Read the licence page and its FAQ before you plan a customer-facing deployment. Current plans and prices are on n8n's pricing page.
n8n vs Zapier Agents, Make and Agentforce: Which Fits?
n8n is the right choice when you want agents that sit inside detailed, multi-system workflows you can inspect node by node, with the option to self-host and a price based on runs rather than steps. A Salesforce-native agent is the better choice when the agent works mainly on Salesforce data, for Salesforce users, inside Salesforce's own security model.
| Option | Billing basis (vendor's own wording) | Best fit |
|---|---|---|
| n8n AI Agent | Per workflow execution, "regardless of complexity" | Technical teams building multi-step, multi-system agents; self-hosting needs |
| Zapier Agents | Tasks: every step in a Zap uses tasks (Zapier pricing) | Business users who want the widest app catalogue with little setup |
| Make AI Agents | Credits: most actions use one credit | Visual scenario builders already standardised on Make |
| Salesforce Agentforce | Salesforce licensing | Agents that act on Salesforce data for Salesforce users and customers |
n8n fits if your agent must read and write across several systems, such as a CRM, an ERP, a ticketing tool and internal APIs; you want to see and test every step; data residency points you to self-hosting; or a run-based price suits long, many-step workflows. Someone on the team must be comfortable owning prompts, credentials and error handling.
n8n is not the best fit if the agent lives almost entirely in Salesforce and must respect its sharing rules and audit for every user, where Agentforce is the native route; or if a business team needs a simple app-to-app automation with no one to maintain it, where a lighter tool is easier to own.
Many companies end up with both: Agentforce or HubSpot's Breeze AI for in-CRM assistance, and n8n for the cross-system work around the CRM. What matters is that each system has a clear owner for each field and each action, so two agents never fight over the same record.
The Bottom Line
The n8n AI agent is a practical way to add reasoning to automation: one node, a model, and tools you control. It pays off when the tools are narrow, the risky actions need approval, and someone owns its testing and monitoring. Twopir Consulting designs and builds integrations and AI automation for Salesforce and HubSpot, including n8n workflows that read and write CRM data safely.
- 1
Start with one high-volume, low-risk process, such as lead or ticket triage.
- 2
Give the agent narrow tools, pinned parameters and a dedicated CRM integration user.
- 3
Require structured output and human approval on every write until results prove reliable.
- 4
Evaluate with real past examples, and re-run the evaluations after every change.
- 5
Retire any legacy agent types and HTTP Request Tool nodes before n8n 3.0.
Put an AI Agent to Work on Your CRM, Safely
Tell us which process eats your team's time. We will map where an n8n agent helps, which tools and approvals it needs, and how it connects to Salesforce or HubSpot.
Schedule a Discovery CallFrequently Asked Questions
It is the AI Agent node: a root node with a chat model, optional memory and at least one tool attached. When the workflow runs, the model decides which tools to call, reads the results and returns an answer or takes an action. Unlike a chain, which follows fixed steps, an agent chooses its own next step.
Not by n8n's own definition. n8n describes itself as fair-code, using the Sustainable Use License and the n8n Enterprise License. The source is available and you can self-host and modify it for internal business use, but you cannot offer n8n to others as a hosted service where they build their own workflows.
There is now only the Tools Agent. n8n deprecated the agent type setting in version 1.82.0, and every AI Agent node works as a Tools Agent using the model's native tool calling. The Conversational, ReAct, SQL, OpenAI Functions and Plan and Execute types are removed in n8n 3.0.
Yes. The Salesforce and HubSpot nodes can be attached to the agent as tools, so it can search, create and update records such as leads, contacts, deals, opportunities and tickets. Use a dedicated integration user with limited access, pin the parameters you can, and require human approval on write actions at first.
Yes, in both directions. The MCP Client Tool lets an n8n agent use tools from an external MCP server. The MCP Server Trigger, and an instance-level MCP server, let AI clients such as Claude Desktop call n8n workflows as tools. The MCP Server Trigger supports SSE and streamable HTTP, not stdio.
There are two costs. n8n Cloud plans are priced on monthly workflow executions, and each Chat Trigger message counts as one execution; the self-hosted Community edition has no licence fee. Separately, you pay your model provider for the tokens the agent uses, which grow with each tool call.
Yes. You can require human review on all of an agent's tools or on selected ones. The workflow pauses and a reviewer approves or denies the tool call in n8n Chat, Slack, Microsoft Teams, Gmail or another supported channel. A denial cancels the action and tells the agent it was refused.
Twopir Consulting
Twopir Consulting helps growing and mid-market companies solve complex CRM, integration, and business system challenges. We implement, rescue, optimize, and integrate complex CRM and revenue systems, including integrations on MuleSoft, Workato, Celigo, Zapier and n8n, for 500+ clients over 12+ years.