对话式 AI 代理节点#
¥Conversational AI Agent node
Feature removed
n8n 已于 2025 年 2 月移除此功能。
¥n8n removed this functionality in February 2025.
对话代理能够进行类似人类的对话。它可以维护上下文,理解用户意图,并提供相关的答案。此代理通常用于构建聊天机器人、虚拟助手和客户支持系统。
¥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.
对话代理会在系统提示中描述 tools,并解析工具调用的 JSON 响应。如果你的首选 AI 模型不支持工具调用,或者你正在处理更简单的交互,则此代理是一个不错的通用选择。更灵活,但可能不如 Tools Agent 准确。
¥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.
有关 AI Agent 节点本身的更多信息,请参阅 AI 代理。
¥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
使用以下参数配置 Conversational Agent。
¥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, provide either static text or an expression for dynamic content to serve as the prompt in the Prompt (User Message) field.
要求特定输出格式#
¥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}:一个 LangChain 表达式,提供你已连接到代理的工具字符串。提供一些关于谁应该使用这些工具以及如何使用这些工具的背景信息或解释。
¥{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}:一个 LangChain 表达式,提供你已连接的输出解析器节点的模式或格式。由于指令本身就是上下文,因此你无需为此表达式提供上下文。
¥{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}}:一个包含用户提示的 LangChain 变量。此变量填充 Prompt 参数的值。提供一些背景信息,说明这是用户的输入。
¥{{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
请参阅主 AI 代理节点的 模板和示例 部分。
¥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.