# n8n

n8n is a fair-code workflow automation platform with a visual editor, hundreds of integrations and AI agent nodes, self-hostable or in the cloud. Learn how teams use it.

## Overview

n8n is a workflow automation platform. You build automations by connecting nodes on a canvas. A trigger starts the workflow, for example a new form submission, an incoming email, a webhook call or a schedule. Action nodes then do things in other apps: create a CRM record, post a chat message, update a spreadsheet or call any HTTP API. Logic nodes add conditions, loops and merges, and code nodes let you write small pieces of JavaScript or Python where no ready-made node fits.

n8n also has AI nodes. The most important is the AI Agent node, which takes a prompt, a chat model, optional memory and a set of tools, and decides which tools to call. This lets an automation read unstructured input, make a judgement and act on it, inside a flow that is otherwise predictable.

A model railway is a fair picture. You lay tracks between stations, add switches that send trains one way or another, and set a timetable. Once it runs, trains move on their own. In n8n, the tracks are connections, the stations are apps, the switches are conditions, and the AI Agent node is a station master who reads each situation and decides which train goes where, within the tracks you laid.

## What it is

n8n is distributed as source-available software that you can run yourself, and as a managed cloud service run by the company.

| Element | Purpose | Example |
|---|---|---|
| Workflow | A graph of connected nodes that runs as one automation | "New lead to CRM and Slack" |
| Trigger node | Starts a workflow | Webhook, schedule, form, app event, chat message |
| App nodes | Read or write data in a specific service | Google Sheets, HubSpot, Postgres, GitHub |
| HTTP Request node | Calls any REST API | An internal pricing service |
| Logic nodes | Route and shape data | If, Switch, Merge, Loop Over Items, Wait |
| Code node | Custom JavaScript or Python | Reformat a date, compute a score |
| AI Agent node | An agent with a model, memory and tools | Classify an email and choose an action |
| Sub-workflows | Workflows called from other workflows | A reusable "enrich company" flow |
| Credentials | Stored, encrypted connection secrets | An API key used by several nodes |
| Executions | The log of every run, with data per node | Inspect and retry a failed run |
| MCP nodes | Use MCP tools, or expose workflows as MCP tools | Let an external agent call a workflow |

## Where it came from

Jan Oberhauser started n8n in Berlin and launched it publicly in October 2019. The name is a numeronym of "nodemation": the letter n, eight letters, and n again. The company, n8n GmbH, was registered in Berlin in late 2019.

n8n first used the Apache 2.0 licence with the Commons Clause, which kept the source readable but limited commercial resale. In March 2022 it moved to its own Sustainable Use License. n8n calls its model **fair-code**: you may view, modify and self-host the software, including for internal business use, but you may not resell it as a competing hosted service. It is not an open-source licence in the sense defined by the Open Source Initiative, and some enterprise features sit under a separate commercial licence.

From 2022 the project moved steadily towards AI. It added nodes built on LangChain for chat models, memory, vector stores, document loaders and agents, then an AI Agent node that could use other nodes as tools. In 2025 it added nodes for the [Model Context Protocol](/tools/mcp): an MCP Client Tool so agents can call tools on MCP servers, and an MCP Server Trigger so a workflow can be offered as a tool to outside agents.

## How it works

### Items flow through nodes

A workflow runs from its trigger. Each node receives a list of items, which are JSON objects, does its work and passes a list of items to the next node. Most nodes run once per item, so a node that receives 20 rows performs 20 actions. Expressions let a node read values from earlier nodes, for example `{{ $json.email }}`.

### Credentials and connections

Credentials are stored once, encrypted, and selected in each node that needs them. This keeps secrets out of workflow definitions and lets administrators rotate keys in one place.

### The AI Agent node

The AI Agent node is a cluster node. It has slots for a chat model, a memory, an optional output parser and any number of tools. Tools can be built-in tool nodes, HTTP requests, code, other workflows or MCP tools. At run time, the agent receives the prompt and the tool descriptions, decides which tools to call, reads the results and produces an answer or a structured output. That output then flows on to normal nodes, which keep the rest of the process predictable. See [function calling](/tools/function-calling) and [agent memory](/tools/agent-memory).

### Errors, waits and approvals

Each node can retry on failure. An Error Trigger workflow can catch failures from other workflows and send alerts. Wait nodes pause a run until a time passes or a webhook arrives, which supports human approval steps: send a message with approve and reject links, and continue when one is clicked. See [human in the loop](/tools/human-in-the-loop).

### Running it

n8n can run as a single process for small set-ups or in queue mode, where a main instance hands executions to separate workers through a queue, for higher volume. Executions are stored so you can open any run, see the data at each node and retry.

## Key concepts and terms

| Term | Meaning |
|---|---|
| Workflow | A connected set of nodes that runs as one automation |
| Node | One step: a trigger, an action, logic or AI |
| Trigger | The node that starts a workflow |
| Item | One JSON record passed between nodes |
| Expression | A template that reads values from earlier nodes |
| Credential | A stored secret used to connect to a service |
| Execution | One run of a workflow, with its data and status |
| Sub-workflow | A workflow called from another workflow |
| Cluster node | A root node, such as AI Agent, with attached sub-nodes |
| Error workflow | A workflow that runs when another one fails |
| Queue mode | A scaling set-up with separate worker processes |
| Fair-code | n8n's term for its source-available licensing model |

## A worked example

This is an illustrative scenario. A small software company receives about 300 inbound leads a month through a web form.

1. **Trigger.** A Form Trigger node fires on each submission with name, email, company and a free-text message.
2. **Enrich.** An HTTP Request node calls a company-data service with the email domain and returns size, industry and country.
3. **Judge.** An AI Agent node receives the form and enrichment data, plus written scoring criteria: target industries, company size of 50 to 2,000 staff, and signs of a real project in the message. It must return JSON with a score from 1 to 10, a one-line reason and a draft reply.
4. **Route.** A Switch node sends scores of 7 or more to one branch and lower scores to another.
5. **High fit.** A CRM node creates a deal, and a chat node notifies the account executive with the reason and draft.
6. **Low fit.** A Wait node holds the draft until a person approves it through a link, then an email node sends it.
7. **Errors.** An error workflow posts any failed run to an operations channel.

In the first month, a person reviews every draft. They correct the agent on about one in ten leads and update the criteria in the prompt. Every execution is stored, so they can see exactly what the agent received and returned.

## Strengths and limitations

**Strengths:**

- Fast to build and easy to explain, because the flow is visible.
- Self-hosting gives control over data location and access.
- Hundreds of integrations plus generic HTTP and code nodes.
- AI agent nodes sit inside predictable flows, which limits their scope.
- Execution logs make debugging and retries straightforward.

**Limitations:**

- Large canvases become hard to read and maintain.
- Version control, code review and testing need extra discipline.
- Complex agent logic can outgrow visual editing.
- The licence is source-available, not open source, which matters for some uses.
- Self-hosting means you run upgrades, backups and scaling yourself.

## How it compares with alternatives

| Option | Choose it when | Trade-off |
|---|---|---|
| n8n | You want visual automation with AI and the option to self-host | Needs discipline as workflows grow |
| Managed tools such as Zapier or Make | You want simple, fully managed automations | Less control over data and hosting |
| [Temporal](/tools/temporal) | You need code-first, durable workflows at scale | Requires engineers and a new programming model |
| [Camunda](/tools/camunda) | Processes are business-owned and modelled in BPMN | Heavier modelling effort |
| Agent frameworks such as [LangGraph](/tools/langgraph) | The logic is mostly agent reasoning written in code | No visual integration catalogue |

## Practical guidance and best practices

1. Keep each workflow small and focused; move reusable parts into sub-workflows.
2. Give every important workflow an error workflow and an alert.
3. Store credentials centrally with the least access each one needs.
4. Ask the AI Agent node for structured output and validate it before acting.
5. Keep agents narrow: one judgement per node, with a short list of tools.
6. Require human approval for agent actions that contact customers, spend money or change records.
7. Export workflows to version control and review changes before deploying.
8. Use queue mode and separate workers when volume grows.
9. Test workflows on recorded sample data before switching them on.

## Common mistakes

- Building one huge workflow that does everything.
- Letting an agent node send customer emails with no review step.
- Hard-coding secrets in Code or HTTP nodes instead of using credentials.
- Ignoring failed executions until someone notices missing data.
- Treating the fair-code licence as permission to resell n8n as a hosted service.
- Giving an agent many overlapping tools, so it picks the wrong one.

## Frequently asked questions

### What is n8n?

n8n is a workflow automation platform with a visual editor, hundreds of integrations, code steps and AI agent nodes. You can run it on your own servers or use the managed cloud service.

### Is n8n open source?

Not in the strict sense. Its Sustainable Use License, which n8n calls fair-code, makes the source available and allows self-hosting and modification, including for internal business use, but it restricts reselling n8n as a service. It is not an OSI-approved licence.

### Can n8n run AI agents?

Yes. The AI Agent node combines a chat model, memory and tools, which can be other nodes, sub-workflows or MCP tools. Its output flows into ordinary nodes, so the agent's judgement sits inside a predictable process.

### Does n8n support MCP?

Yes. An MCP Client Tool node lets agents in n8n call tools on MCP servers, and an MCP Server Trigger node lets a workflow be offered as a tool to external MCP clients.

### Should I self-host or use the cloud?

Self-host when you need control over where data lives, private network access or custom scaling, and you can run the service. Use the cloud when you want the vendor to handle upgrades, backups and availability.

### How does n8n handle failures?

Nodes can retry on error, failed executions are stored for inspection and retry, and an error workflow can catch failures and send alerts.

## Glossary

- Node: one step in a workflow.
- Trigger: the event that starts a workflow.
- Item: a JSON record passed between nodes.
- Credential: a stored secret for a connection.
- Execution: a single run of a workflow.
- Sub-workflow: a workflow called by another.
- AI Agent node: a node that runs a model with tools and memory.
- Queue mode: running executions on separate workers.
- Self-hosting: running the software on your own infrastructure.
- Fair-code: n8n's source-available licensing model.

## Summary

n8n is a visual workflow automation platform, started in Berlin in 2019, that connects hundreds of apps through triggers, action nodes, logic and code, and adds AI Agent nodes that use models, memory and tools, including MCP. It can be self-hosted under its source-available Sustainable Use License or used as a cloud service. It is quick for connecting business systems and placing judgement steps inside predictable flows. Keep workflows modular, handle errors, store credentials centrally, validate agent output and keep a person in the loop for actions with real consequences.
