调用 n8n 工作流工具节点#
¥Call n8n Workflow Tool node
调用 n8n 工作流工具节点是一个 tool,允许 agent 运行另一个 n8n 工作流并获取其输出数据。
¥The Call n8n Workflow Tool node is a tool that allows an agent to run another n8n workflow and fetch its output data.
本页提供“调用 n8n 工作流工具”节点的节点参数以及更多资源的链接。
¥On this page, you'll find the node parameters for the Call n8n Workflow 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
描述#
¥Description
输入自定义代码描述。此步骤告知代理何时使用此工具。例如:
¥Enter a custom code a description. This tells the agent when to use this tool. For example:
调用此工具获取随机颜色输入应为以逗号分隔的要排除的颜色名称字符串。
¥Call this tool to get a random color. The input should be a string with comma separated names of colors to exclude.
源#
¥Source
指示 n8n 要调用哪个工作流。你可以选择以下任一选项:
¥Tell n8n which workflow to call. You can choose either:
- 在数据库中从列表中选择工作流或输入工作流 ID。
¥Database to select the workflow from a list or enter a workflow ID.
- 请在下方定义并复制完整的 工作流 JSON。
¥Define Below and copy in a complete workflow JSON.
工作流输入#
¥Workflow Inputs
使用数据库作为工作流源时,选择子工作流(并在子工作流中定义工作流输入架构)后,即可定义工作流输入。
¥When using Database as workflow source, once you choose a sub-workflow (and define the Workflow Input Schema in the sub-workflow), you can define the Workflow Inputs.
选择“刷新”按钮,从子工作流中提取输入字段。
¥Select the Refresh button to pull in the input fields from the sub-workflow.
你可以使用以下选项的任意组合定义工作流输入值:
¥You can define the workflow input values using any combination of the following options:
- 提供固定值
¥providing fixed values
- 使用表达式引用当前工作流中的数据。
¥using expressions to reference data from the current workflow
- 通过选择字段右侧的“AI”按钮来启动 让 AI 模型指定参数。
¥letting the AI model specify the parameter by selecting the button AI button on the right side of the field
- 在表达式中使用
$fromAI()功能 来控制模型填充数据的方式,并将 AI 生成的输入与其他自定义输入混合。
¥using the $fromAI() function in expressions to control the way the model fills in data and to mix AI generated input with other custom input
要引用当前工作流中的数据,请将字段从输入面板拖到已选中“表达式”模式的字段中。
¥To reference data from the current workflow, drag fields from the input panel to the field with the Expressions mode selected.
要开始使用 $fromAI() 功能,请选择字段右侧的 "允许模型定义此参数" 按钮,然后使用方框上的 X 恢复为用户自定义值。该字段将更改为预先填充了 $fromAI() 表达式的表达式字段。你可以在此处自定义表达式,添加其他静态或动态内容,或调整 $fromAI() 函数参数。
¥To get started with the $fromAI() function, select the "Let the model define this parameter" button on the right side of the field and then use the X on the box to revert to user-defined values. The field will change to an expression field pre-populated with the $fromAI() expression. From here, you can customize the expression to add other static or dynamic content, or tweak the $fromAI() function parameters.
模板和示例#
¥Templates and examples
相关资源#
¥Related resources
Refer to LangChain's documentation on tools for more information about tools in LangChain.
View n8n's Advanced AI documentation.