Documentacao n8n
Documentacao n8n
Using n8n Integrations Hosting n8n Code in n8n Advanced AI API Embed
Learn more about how n8n builds on Explore a wide range of AI workflow
LangChain. templates on the n8n website.
Related resources
Related documentation and tools.
Node types
This feature uses Cluster nodes: groups of root and sub nodes that work together.
Cluster nodes are node groups that work together to provide functionality in an n8n
workflow. Instead of using a single node, you use a root node and one or more sub-
nodes. This allows extensive configuration of node functionality.
Workflow templates
You can browse workflow templates in-app or on the n8n website Workflows page.
Chat trigger
Use the n8n Chat Trigger to trigger a workflow based on chat interactions.
Chatbot widget
n8n provides a chatbot widget that you can use as a frontend for AI-powered chat
workflows. Refer to the @n8n/chat npm page for usage information.
Previous Next
Pagination Tutorial: Build an AI workflow in n8n
Using n8n Integrations Hosting n8n Code in n8n Advanced AI API Embed
n8n is available as a Cloud service, npm module, and Docker image. For this
quickstart, n8n recommends using Cloud. A free trial is available for new users.
2. Search for Chat Trigger. n8n shows a list of nodes that match the search.
3. Select Chat Trigger to add the node to the canvas. n8n opens the node.
1. Select the Add node connector. n8n opens the nodes panel.
2. Search for Agent. n8n shows a list of nodes that match the search.
3. Select AI Agent. n8n adds the node to the canvas and opens it.
Memory, so that the workflow can remember and use previous sections of the
chat.
Use the connectors on the bottom of the AI Agent node to connect the following:
Model: OpenAI Chat Model. Set up the credentials for this node.
Because n8n can connect to any service with a public API, this is a powerful tool.
This example generates some fake data in a workflow, and loads it in to the AI
workflow. The AI workflow passes a parameter to the workflow generating the data,
to ensure it only returns data that's intended to be public.
1 {
2 "name": "Workflow tool example",
3 "nodes": [
4 {
5 "parameters": {
6 "jsCode": "return [{\"fruit\": \"apple\", \"color\": \"green\", \"dataPrivacyLevel\": \"public\"},{\"fruit\": \"ba
7 },
8 "id": "4a30b74c-ed27-4668-8e68-c2e3a630ecd9",
9 "name": "Code",
10 "type": "n8n-nodes-base.code",
11 "typeVersion": 2,
12 "position": [
13 1180,
14 500
15 ]
16 },
17 {
18 "parameters": {
19 "conditions": {
20 "string": [
21 {
22 "value1": "={{ $json.dataPrivacyLevel }}",
23 "value2": "={{ $('Execute Workflow Trigger').item.json.visibility }}"
24 }
25 ]
26 }
27 },
28 "id": "eb479841-8099-4537-b89b-4b9867446688",
29 "name": "Filter",
30 "type": "n8n-nodes-base.filter",
31 "typeVersion": 1,
32 "position": [
33 1380,
34 500
35 ]
36 },
37 {
38 "parameters": {
39 "aggregate": "aggregateAllItemData",
40 "include": "specifiedFields",
41 "fieldsToInclude": "fruit, color",
42 "options": {}
43 },
44 "id": "6d6c847d-7417-4780-8a8b-b99996cd6166",
45 "name": "Aggregate",
46 "type": "n8n-nodes-base.aggregate",
47 "typeVersion": 1,
48 "position": [
49 1600,
50 500
51 ]
52 },
53 {
54 "parameters": {},
55 "id": "1ec54b09-7533-4280-8bf2-54407d6bf134",
56 "name": "Execute Workflow Trigger",
57 "type": "n8n-nodes-base.executeWorkflowTrigger",
58 "typeVersion": 1,
59 "position": [
60 1000,
61 500
62 ]
63 }
64 ],
65 "pinData": {},
66 "connections": {
67 "Code": {
68 "main": [
69 [
70 {
71 "node": "Filter",
72 "type": "main",
73 "index": 0
74 }
75 ]
76 ]
77 },
78 "Filter": {
79 "main": [
80 [
81 {
82 "node": "Aggregate",
83 "type": "main",
84 "index": 0
85 }
86 ]
87 ]
88 },
89 "Execute Workflow Trigger": {
90 "main": [
91 [
92 {
93 "node": "Code",
94 "type": "main",
95 "index": 0
96 }
97 ]
98 ]
99 }
100 }
101 }
The workflow uses the Code node to generate a sample data set, containing a
list of fruits, their colors, and whether this information should be public or
private.
2. Copy the workflow ID from workflow URL. The ID is the group of random
numbers and letters at the end of the URL.
3. In the AI workflow, select the Tool output on the AI Agent. n8n opens the nodes
panel.
4. Select Custom n8n Workflow Tool. n8n adds the node to the canvas and opens
it.
Name: Fruit
Workflow ID: Paste in the workflow ID that you copied from the example
workflow URL.
Response Property Name: data . This is the name of the item created in the
Aggregate node in the example workflow.
6. Select Add Value in Workflow Values to pass information to the workflow you're
calling. Configure the value as follows:
Name: visibility
Type: String
Value: public
n8n makes this value available to the workflow in the output data of the trigger
node in the workflow you're calling. In this example, to access the value in an
expression, use {{ $('Execute Workflow Trigger').item.json.visibility
}} . You can see this in practice in the Filter node in the sample workflow.
Next steps
Explore n8n using the Quickstarts.
Learn more about AI concepts and view examples in Examples and concepts.
Read What product people need to know about LangChain to learn more about
AI concepts and terminology.
Previous Next
Advanced AI Overview
Using n8n Integrations Hosting n8n Code in n8n Advanced AI API Embed
Introduction
Learning resources: n8n's documentation for LangChain assumes you're familiar
What is a tool? with AI and LangChain concepts. This page provides links to learning resources.
Use Google Sheets as a data
source LangChain concepts and features in n8n: how n8n represents LangChain
Call an API to fetch data concepts and features.
Previous Next
Tutorial: Build an AI workflow in n8n Langchain concepts in n8n
Using n8n Integrations Hosting n8n Code in n8n Advanced AI API Embed
Root nodes
Chains
Available nodes:
Summarization Chain
Agents
An agent has access to a suite of tools, and determines which ones to use
depending on the user input. Agents can use multiple tools, and use the output of
one tool as the input to the next. Source
Available nodes:
Agent
Vector stores
Vector stores store embedded data, and perform vector searches on it.
Miscellaneous
Utility nodes.
LangChain Code: import LangChain. This means if there is functionality you need
that n8n hasn't created a node for, you can still use it.
Sub-nodes
Each root node can have one or more sub-nodes attached to it.
Document loaders
Document loaders add data to your chain as documents. The data source can be a
file or web service.
Available nodes:
Language models
LLMs (large language models) are programs that analyze datasets. They're the key
element of working with AI.
Available nodes:
Cohere Model
Ollama Model
OpenAI Model
Memory
Available nodes:
Motorhead
Xata
Zep
Output parsers
Output parsers take the text generated by an LLM and format it to match the
structure you require.
Available nodes:
Retrievers
MultiQuery Retriever
Workflow Retriever
Text splitters
Text splitters break down data (documents), making it easier for the LLM to process
the information and return accurate results.
Available nodes:
Token Splitter
Tools
Utility tools.
Calculator
Code Tool
SerpAPI
Wikipedia
Wolfram|Alpha
Workflow Tool
Embeddings
Available nodes:
Embeddings Cohere
Embeddings Ollama
Embeddings OpenAI
Miscellaneous
Previous Next
Overview LangChain learning resources
Using n8n Integrations Hosting n8n Code in n8n Advanced AI API Embed
n8n offers space to discuss LangChain on the Discord. Join to share your projects
and discuss ideas with the community.
Previous Next
Langchain concepts in n8n Introduction
Using n8n Integrations Hosting n8n Code in n8n Advanced AI API Embed
Previous Next
LangChain learning resources What is a tool?
Using n8n Integrations Hosting n8n Code in n8n Advanced AI API Embed
LangChain in n8n
Overview In AI, 'tools' has a specific meaning. Tools act like addons that your AI can use to
Langchain concepts in n8n access extra context or resources.
LangChain learning
resources Here are a couple of other ways of expressing it:
Examples and concepts Tools are interfaces that an agent can use to interact with the world (source)
Introduction
We can think of these tools as being almost like functions that your AI model can
What is a tool?
call (source)
Use Google Sheets as a data
source
Call an API to fetch data
Set a human fallback for AI
Tools in n8n
workflows
n8n provides tool sub-nodes that you can connect to your AI agent. As well as
providing some popular tools, such as Wikipedia and SerpAPI, n8n provides two
especially powerful tools:
Custom n8n Workflow Tool: use this to load any n8n workflow as a tool.
Custom Code Tool: write code that your agent can run.
The next three examples highlight the Custom n8n Workflow Tool:
Previous Next
Introduction Use Google Sheets as a data source
Using n8n Integrations Hosting n8n Code in n8n Advanced AI API Embed
Key features
This workflow uses:
Chat Trigger: start your workflow and respond to user chat interactions. The
node provides a customizable chat interface.
Agent: the key piece of the AI workflow. The Agent interacts with other
components of the workflow and makes decisions about what tools to use.
Custom n8n Workflow Tool: plug in n8n workflows as custom tools. In AI, a tool is
an interface the AI can use to interact with the world (in this case, the data
provided by your workflow). It allows the AI model to access information beyond
its built-in dataset.
3. Copy in the JSON, or select Workflow menu > Import from file....
Previous Next
What is a tool? Call an API to fetch data
Using n8n Integrations Hosting n8n Code in n8n Advanced AI API Embed
Key features
This workflow uses:
Chat Trigger: start your workflow and respond to user chat interactions. The
node provides a customizable chat interface.
Agent: the key piece of the AI workflow. The Agent interacts with other
components of the workflow and makes decisions about what tools to use.
Custom n8n Workflow Tool: plug in n8n workflows as custom tools. In AI, a tool is
an interface the AI can use to interact with the world (in this case, the data
provided by your workflow). It allows the AI model to access information beyond
its built-in dataset.
A Basic LLM Chain with an Auto-fixing Output Parser and Structured Output
Parser to read the user's query and set parameters for the API call based on the
user input.
3. Copy in the JSON, or select Workflow menu > Import from file....
Previous Next
Use Google Sheets as a data source Set a human fallback for AI workflows
Using n8n Integrations Hosting n8n Code in n8n Advanced AI API Embed
Key features
This workflow uses:
Chat Trigger: start your workflow and respond to user chat interactions. The
node provides a customizable chat interface.
Agent: the key piece of the AI workflow. The Agent interacts with other
components of the workflow and makes decisions about what tools to use.
Custom n8n Workflow Tool: plug in n8n workflows as custom tools. In AI, a tool is
an interface the AI can use to interact with the world (in this case, the data
provided by your workflow). It allows the AI model to access information beyond
its built-in dataset.
3. Copy in the JSON, or select Workflow menu > Import from file....
Previous Next
Call an API to fetch data n8n public REST API