Conversational AI Agent node#
The Conversational 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.
The Conversational Agent describes tools in the system prompt and parses JSON responses for tool calls. If your preferred AI model doesn't support tool calling or you're handling simpler interactions, this agent is a good general option. It's more flexible but may be less accurate than the Tools Agent.
Refer to AI Agent for more information on the AI Agent node itself.
You can use this agent with the Chat Trigger node. Attach a memory sub-node so that users can have an ongoing conversation with multiple queries. Memory doesn't persist between sessions.
Node parameters#
Configure the Conversational Agent using the following parameters.
Prompt#
Select how you want the node to construct the prompt (also known as the user's query or input from the chat).
Choose from:
- Take from previous node automatically: If you select this option, the node expects an input from a previous node called
chatInput
. - Define below: If you select this option, enter the Text you want to use as the prompt. You can use expressions here for dynamic content.
Require Specific Output Format#
This parameter controls whether you want the node to require a specific output format. When turned on, n8n prompts you to connect one of these output parsers to the node:
Node options#
Refine the Conversational Agent node's behavior using these options:
Human Message#
Tell the agent about the tools it can use and add context to the user's input.
You must include these expressions and variable:
{tools}
: A LangChain expression that provides a string of the tools you've connected to the Agent. Provide some context or explanation about who should use the tools and how they should use them.{format_instructions}
: A LangChain expression that provides the schema or format from the output parser node you've connected. Since the instructions themselves are context, you don't need to provide context for this expression.{{input}}
: A LangChain variable containing the user's prompt. This variable populates with the value of the Prompt parameter. Provide some context that this is the user's input.
Here's an example of how you might use these strings:
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
System Message#
If you'd like to send a message to the agent before the conversation starts, enter the message you'd like to send.
Use this option to guide the agent's decision-making.
Max Iterations#
Enter the number of times the model should run to try and generate a good answer from the user's prompt.
Defaults to 10
.
Return Intermediate Steps#
Select whether to include intermediate steps the agent took in the final output (turned on) or not (turned off).
This could be useful for further refining the agent's behavior based on the steps it took.
Templates and examples#
Refer to the main AI Agent node's Templates and examples section.
Common issues#
For common questions or issues and suggested solutions, 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.