Skip to content

AI 代理工具节点#

¥Tools AI Agent node

工具代理使用外部 tools 和 API 来执行操作和检索信息。它可以了解不同工具的功能,并根据任务确定使用哪个工具。此代理有助于将 LLM 与各种外部服务和数据库集成。

¥The Tools 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.

此代理具有更强的工具协作能力,并可确保标准输出格式。

¥This agent has an enhanced ability to work with tools and can ensure a standard output format.

工具代理实现了 Langchain 的工具调用 接口。此接口描述可用工具及其架构。代理还改进了输出解析功能,因为它将解析器作为格式化工具传递给模型。

¥The Tools Agent implements Langchain's tool calling interface. This interface describes available tools and their schemas. The agent also has improved output parsing capabilities, as it passes the parser to the model as a formatting tool.

有关 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.

此代理支持以下聊天模型:

¥This agent supports the following chat models:

¥OpenAI Chat Model

¥Groq Chat Model

¥Mistral Cloud Chat Model

¥Anthropic Chat Model

¥Azure OpenAI Chat Model

The Tools Agent can use the following tools...

节点参数#

¥Node parameters

使用以下参数配置 Tools Agent。

¥Configure the Tools 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 Tools Agent node's behavior using these options:

系统消息#

¥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.

自动传递二进制图片#

¥Automatically Passthrough Binary Images

Use this option to control whether binary images should be automatically passed through to the agent as image type messages (turned on) or not (turned off).

启用流式传输#

¥Enable Streaming

启用后,AI 代理会在生成答案的同时实时将数据发送回用户。这对于长时间运行的生成任务非常有用。此功能默认启用。

¥When enabled, the AI Agent sends data back to the user in real-time as it generates the answer. This is useful for long-running generations. This is enabled by default.

Streaming requirements

要使流式传输正常工作,你的工作流必须使用支持流式响应的触发器,例如将“响应模式”设置为“流式”的 聊天触发器Webhook 节点。

¥For streaming to work, your workflow must use a trigger that supports streaming responses, such as the Chat Trigger or Webhook node with Response Mode set to Streaming.

模板和示例#

¥Templates and examples

请参阅主 AI 代理节点的 模板和示例 部分。

¥Refer to the main AI Agent node's Templates and examples section.

$fromAI() 工具的动态参数#

¥Dynamic parameters for tools with $fromAI()

要了解如何动态填充应用节点工具的参数,请参阅 使用 $fromAI() 让 AI 指定工具参数

¥To learn how to dynamically populate parameters for app node tools, refer to Let AI specify tool parameters with $fromAI().

常见问题#

¥Common issues

有关常见问题或建议的解决方案,请参阅 常见问题

¥For common questions or issues and suggested solutions, refer to Common issues.