Skip to content

Plan and Execute Agent node#

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.

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

Node parameters#

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#

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

Available LangChain expressions:

  • {previous_steps}: Contains information about the previous steps the agent's already completed.
  • {current_step}: Contains information about the current step.
  • {agent_scratchpad}: Information to remember for the next iteration.

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#

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.

This page was