Skip to content

规划和执行代理节点(Plan and Execute Agent node)#

计划与执行代理类似于 ReAct 代理,但更侧重于规划。它首先创建一个高层次的计划来解决给定任务,然后逐步执行该计划。对于需要结构化方法和仔细规划的任务,这个代理最为有用。

🌐 The Plan and Execute Agent is like the ReAct agent but with a focus on planning. It first creates a high-level plan to solve the given task and then executes the plan step by step. This agent is most useful for tasks that require a structured approach and careful planning.

有关 AI Agent 节点本身的更多信息,请参考 AI Agent

🌐 Refer to AI Agent for more information on the AI Agent node itself.

节点参数(Node parameters)#

使用以下参数配置 Plan and Execute Agent。

🌐 Configure the Plan and Execute 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 Plan and Execute Agent node's behavior using these options:

人类消息模板(Human Message Template)#

输入 n8n 将在每个步骤执行期间发送给代理的消息。

🌐 Enter a message that n8n will send to the agent during each step execution.

可用的 LangChain 表达式:

🌐 Available LangChain expressions:

  • {previous_steps}:包含有关代理已完成的前几个步骤的信息。
  • {current_step}:包含有关当前步骤的信息。
  • {agent_scratchpad}:需要记住以备下次迭代的信息。

追踪元数据(Tracing Metadata)#

Add custom key-value metadata to tracing events for this agent. This is useful for filtering and debugging runs in tracing tools like LangSmith.

Entries with empty keys or values are ignored.

模板和示例(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.