Skip to content

计划与执行代理节点#

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

有关 AI 代理节点本身的更多信息,请参阅 AI 代理

节点参数#

使用以下参数配置计划与执行代理:

提示#

选择节点如何构建提示词(也称为用户的查询或聊天输入)。

可选方式:

  • 自动从上一节点获取:选择此选项时,节点会从名为 chatInput 的上一节点获取输入。
  • 自定义定义:选择此选项时,在提示词(用户消息)字段中提供静态文本或动态表达式作为提示内容。

要求特定输出格式#

此参数控制节点是否需要特定的输出格式。当启用时,n8n 会提示您连接以下输出解析器之一到该节点:

节点选项#

使用这些选项微调计划与执行代理节点的行为:

人工消息模板#

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

可用的 LangChain 表达式:

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

模板与示例#

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

常见问题#

关于常见问题或疑问及建议解决方案,请参阅常见问题

AI glossary#

  • completion: Completions are the responses generated by a model like GPT.
  • hallucinations: Hallucination in AI is when an LLM (large language model) mistakenly perceives patterns or objects that don't exist.
  • vector database: A vector database stores mathematical representations of information. Use with embeddings and retrievers to create a database that your AI can access when answering questions.
  • vector store: A vector store, or vector database, stores mathematical representations of information. Use with embeddings and retrievers to create a database that your AI can access when answering questions.