AI Agent node#
An AI agent is an autonomous system that receives data, makes rational decisions, and acts within its environment to achieve specific goals. The AI agent's environment is everything the agent can access that isn't the agent itself, which might include customer queries, tools, or other context.
The AI Agent node gives you six LangChain agent options.
On this page, you'll find a summary of the available agents with links to more detailed pages on each, templates and examples, and links to more resources.
Connect a tool
You must connect at least one tool sub-node to an AI Agent node.
Available agents#
n8n provides these agents:
-
Tools Agent (default): This agent uses external tools and APIs to perform actions and retrieve information. It can understand the capabilities of different tools and determine which tool to use depending on the task. This agent helps integrate LLMs with various external services and databases.
Begin here
n8n recommends using this agent for most use cases. It will handle most scenarios and provides the best experience when working with tools.
-
Conversational Agent: This agent has human-like conversations. It can maintain context, understand user intent, and provide relevant answers. This agent is typically used for building chatbots, virtual assistants and customer support systems. If your preferred AI model doesn't support tool calling or you're handling simpler interactions, this agent is a good option.
- OpenAI Functions Agent: Use this agent with an OpenAI functions model. You must use the OpenAI Chat Model with this agent.
- Plan and Execute Agent: This agent creates a high-level plan to solve the given task and then executes the plan step by step. It's most useful for tasks that require a structured approach and careful planning.
-
ReAct Agent: This agent reasons about a given task, determines the necessary actions, and then executes them. It follows the cycle of reasoning and acting until it completes the task. The ReAct agent can break down complex tasks into smaller sub-tasks, prioritise them, and execute them one after the other.
No memory
The ReAct agent doesn't support memory sub-nodes. This means it can't recall previous prompts or simulate an ongoing conversation.
-
SQL Agent: This agent uses a SQL database as a data source. It can understand natural language questions, convert them into SQL queries, execute the queries, and present the results in a user-friendly format. This agent is valuable for building natural language interfaces to databases.
Templates and examples#
Related resources#
Refer to LangChain's documentation on agents for more information about the service.
New to AI Agents? Read the n8n blog introduction to AI agents.
View n8n's Advanced AI documentation.
Common issues#
For common errors or issues and suggested resolution steps, refer to Common Issues.
AI glossary#
- completion: Completions are the responses generated by a model like GPT.
- hallucinations: Hallucination in AI is when an LLM (large language model) mistakenly perceives patterns or objects that don't exist.
- vector database: A vector database stores mathematical representations of information. Use with embeddings and retrievers to create a database that your AI can access when answering questions.
- vector store: A vector store, or vector database, stores mathematical representations of information. Use with embeddings and retrievers to create a database that your AI can access when answering questions.