对话式 AI 代理节点(Conversational AI Agent node)#
功能已移除
n8n 在 2025 年 2 月移除了此功能。
该对话代理可以进行类似人类的对话。它能够保持上下文,理解用户意图,并提供相关回答。该代理通常用于构建聊天机器人、虚拟助手和客户支持系统。
🌐 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.
对话代理在系统提示中描述了工具,并解析用于工具调用的 JSON 响应。如果你使用的 AI 模型不支持工具调用,或你处理的是较简单的交互,这个代理是一个不错的通用选项。它更灵活,但可能不如工具代理准确。
🌐 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 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)#
使用以下参数配置 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 表达式,用于提供你已连接到 Agent 的工具字符串。提供一些关于谁应该使用这些工具以及如何使用它们的背景信息或说明。{format_instructions}:一个 LangChain 表达式,用于提供你所连接的输出解析器节点的模式或格式。由于说明本身就是上下文,因此你无需为此表达式提供额外的上下文。{{input}}:一个 LangChain 变量,包含用户的提示。该变量会被 Prompt 参数的值填充。提供一些上下文说明这是用户的输入。
以下是一个如何使用这些字符串的示例:
🌐 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.