n8n · AI Agents · Workflow Automation

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.

Section 01 · Short Answer

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.

Section 02 · Architecture

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.

Step 1 · Trigger

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.

Step 2 · Reason

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.

Step 3 · Act

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.

Step 4 · Deliver

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.

Section 03 · What Changed

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 typeStatusWhat to use instead
Tools AgentCurrentThe default behaviour of every current AI Agent node
Conversational AgentRemoved in 3.0AI Agent node with a memory sub-node and a Chat Trigger
SQL AgentRemoved in 3.0AI Agent node with a Postgres or MySQL tool sub-node
OpenAI Functions, Plan and Execute, ReActRemoved in 3.0AI 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.

Section 04 · Tools

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.

ToolWhat it lets the agent doTypical use
App nodes (Salesforce, HubSpot and others)Read and write records through the same node used in normal workflowsLook up an account, create a task, update a deal or ticket
HTTP RequestCall any REST API; the tool-only "Optimize Response" option trims what is sent to the modelAn internal API, an enrichment service, an endpoint the app node lacks
Call n8n Workflow ToolRun another n8n workflow and use its outputWrap a tested, multi-step process as one safe action
Code ToolRun JavaScript or Python the builder wroteCalculations, formatting, validation rules
Vector store toolsSearch embedded documents (retrieval-augmented generation)Answer from policies, product docs or contracts
AI Agent ToolCall another agent as a tool, in one or more layersA coordinator agent with specialist sub-agents
MCP Client ToolUse the tools an external MCP server exposesConnect 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.

Section 05 · Knowledge and Connectivity

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.

Section 06 · Step by Step

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.

1. Choose the trigger
Use the form's webhook or an n8n Form Trigger. Map the fields you need (name, company, email, message) with an Edit Fields node so the agent gets clean input.
2. Add the AI Agent node and a chat model
Attach a chat model sub-node and its credential. Pick the model on test results, not reputation; you can swap it later without rebuilding the workflow.
3. Write the system message
State the role, the allowed actions, the categories, what to do when unsure ("send to human review"), and what never to do ("never change the owner or delete records").
4. Attach narrow tools
Add the Salesforce or HubSpot node as tools: one to search companies, one to create or update a lead. Pin every parameter you can, and let $fromAI() fill only the values the model must choose. Add a Slack tool for alerts.
5. Require structured output
Turn on "Require Specific Output Format" with a Structured Output Parser (category, confidence, record ID, summary) so later nodes and reports can rely on the fields.
6. Add human review and error handling
Require approval on the write tool, at least while you build confidence, and set an error workflow that alerts the owner when a run fails.
7. Test, evaluate, then activate
Run 20 to 50 real past enquiries through a light evaluation, inspect each tool call, tighten the prompt and tools, and only then activate the workflow.

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.

Section 07 · Use Cases

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.

An n8n workflow canvas titled Multi AI Agent: a chat message trigger feeds an AI Agent Researcher node using an OpenAI chat model and SerpAPI tool, followed by SEO Writer, Editor and Formatter message model nodes, ending in a Google Drive create-from-text node
A multi-step content pipeline in n8n: a researcher agent with a web-search tool, then writer, editor and formatter steps, saving the draft to Google Drive.

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.

Section 08 · Production Controls

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.

1. Human approval for tool calls. n8n can pause a run before a chosen tool executes and ask a reviewer to approve or deny it in n8n Chat, Slack, Microsoft Teams, Gmail and other channels. A denial cancels the action and tells the agent. See human-in-the-loop for tools.
2. Guardrails on input and output. The Guardrails node checks text for jailbreak attempts, personal data, secret keys, off-topic requests and URLs, or masks them before they reach the model or leave the workflow.
3. Evaluations, not spot checks. Light evaluations run a small hand-built dataset before launch; metric-based evaluations score a larger dataset after launch. Re-run them every time you change the prompt, the model or a tool.
4. An error workflow on every agent. Set an error workflow, which starts with the Error Trigger, so a failed run alerts the owner instead of failing silently. Keep Max Iterations low enough to stop runaway loops.
5. Least-privilege credentials. Connect the CRM with a dedicated integration user whose access matches the tools, not an admin login. n8n encrypts stored credentials with an encryption key; on self-hosted instances, set and protect that key yourself.
6. Persistent memory and stores. Use a database-backed memory and a production vector store. The in-memory options lose data on restart and are not built for production use.

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.

Section 09 · Hosting and Licence

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.

Questionn8n CloudSelf-hosted
Who runs itn8nYour team, on your servers or cloud account (Docker)
How you payPlans priced on monthly workflow executions, with unlimited steps, users and workflowsCommunity edition free; Business and Enterprise licences are paid
AI Agent, MCP and AI nodesIncluded on all plansAI Agent node in every edition; light evaluations need at least the free Registered Community edition
ScalingManaged by n8nQueue mode: a main instance hands executions to workers through Redis
SSO, custom roles, log streamingEnterprise planSSO 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.

Section 10 · Comparison

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.

OptionBilling basis (vendor's own wording)Best fit
n8n AI AgentPer workflow execution, "regardless of complexity"Technical teams building multi-step, multi-system agents; self-hosting needs
Zapier AgentsTasks: every step in a Zap uses tasks (Zapier pricing)Business users who want the widest app catalogue with little setup
Make AI AgentsCredits: most actions use one creditVisual scenario builders already standardised on Make
Salesforce AgentforceSalesforce licensingAgents 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.

Section 11 · Bottom Line

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. 1

    Start with one high-volume, low-risk process, such as lead or ticket triage.

  2. 2

    Give the agent narrow tools, pinned parameters and a dedicated CRM integration user.

  3. 3

    Require structured output and human approval on every write until results prove reliable.

  4. 4

    Evaluate with real past examples, and re-run the evaluations after every change.

  5. 5

    Retire any legacy agent types and HTTP Request Tool nodes before n8n 3.0.

Ready to Start

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 Call

FAQ

Frequently 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.

TC

Twopir Consulting

Salesforce Partner · HubSpot Partner

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.