AI 代理工具节点#
¥AI Agent Tool node
AI 代理工具节点允许工作流中的根级 agent 调用其他代理作为工具,从而简化多代理编排。
¥The AI Agent Tool node allows a root-level agent in your workflow to call other agents as tools to simplify multi-agent orchestration.
主代理 可以监督 AI 代理工具节点,并将工作委派给专门处理不同任务和知识的节点。此功能允许你在单个工作流中使用多个代理,而无需像子工作流那样管理复杂的上下文和变量。你可以将 AI 代理工具节点嵌套到多个层中,以适应更复杂的多层用例。
¥The primary agent can supervise and delegate work to AI Agent Tool nodes that specialize in different tasks and knowledge. This allows you to use multiple agents in a single workflow without the complexity of managing context and variables that sub-workflows require. You can nest AI Agent Tool nodes into multiple layers for more complex multi-tiered use cases.
本页提供 AI 代理工具节点的参数以及更多资源的链接。
¥On this page, you'll find the node parameters for the AI Agent Tool node, and links to more resources.
Parameter resolution in sub-nodes
Sub-nodes behave differently to other nodes when processing multiple items using an expression.
Most nodes, including root nodes, take any number of items as input, process these items, and output the results. You can use expressions to refer to input items, and the node resolves the expression for each item in turn. For example, given an input of five name values, the expression {{ $json.name }} resolves to each name in turn.
In sub-nodes, the expression always resolves to the first item. For example, given an input of five name values, the expression {{ $json.name }} always resolves to the first name.
节点参数#
¥Node parameters
使用以下参数配置 AI Agent Tool 节点:
¥Configure the AI Agent Tool node using these parameters:
- 描述:请向 LLM 描述此代理的用途和职责范围。良好的、具体的描述可以告知父代理何时将任务委托给此代理进行处理。
¥Description: Give a description to the LLM of this agent's purpose and scope of responsibility. A good, specific description tells the parent agent when to delegate tasks to this agent for processing.
- 提示(用户消息):向 LLM 发送的提示信息,用于解释要执行的操作以及要返回的信息。
¥Prompt (User Message): The prompt to the LLM explaining what actions to perform and what information to return.
- 要求特定输出格式:是否希望节点要求特定的输出格式。启用此选项后,n8n 会提示你连接输出解析器 详见主代理页面 之一。
¥Require Specific Output Format: Whether you want the node to require a specific output format. When turned on, n8n prompts you to connect one of the output parsers described on the main agent page.
- 启用回退模型:是否启用回退模型。启用后,n8n 会提示你连接备用聊天模型,以便在主模型出现故障或不可用时使用。
¥Enable Fallback Model: Whether to enable a fallback model. When enabled, n8n prompts you to connect a backup chat model to use in case the primary model fails or isn't available.
节点选项#
¥Node options
使用以下选项优化 AI 代理工具节点的行为:
¥Refine the AI Agent Tool node's behavior using these options:
- 系统消息:对话开始前要发送给代理的消息。
¥System Message: A message to send to the agent before the conversation starts.
- 最大迭代次数:模型在停止运行前生成响应的最大运行次数。
¥Max Iterations: The maximum number of times the model should run to generate a response before stopping.
- 返回中间步骤:是否在最终输出中包含代理执行的中间步骤。
¥Return Intermediate Steps: Whether to include intermediate steps the agent took in the final output.
- 自动传递二进制镜像:是否应将二进制图片作为图片类型消息自动传递给代理。
¥Automatically Passthrough Binary Images: Whether binary images should be automatically passed through to the agent as image type messages.
- 批处理:是否启用以下批处理选项以进行速率限制:
¥Batch Processing: Whether to enable the following batch processing options for rate limiting:
-
批处理大小:要并行处理的项目数。这有助于进行速率限制,但可能会影响日志输出顺序。
¥Batch Size: The number of items to process in parallel. This helps with rate limiting but may impact the log output ordering.
-
批次间延迟:批次之间等待的毫秒数。
¥Delay Between Batches: The number of milliseconds to wait between batches.
模板和示例#
¥Templates and examples
$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().