Skip to content

AI Agent Tool node#

The AI Agent Tool node allows a root-level agent in your workflow to call other agents as tools to simplify multi-agent orchestration.

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.

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#

Configure the AI Agent Tool node using these parameters:

  • 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.
  • Prompt (User Message): The prompt to the LLM explaining what actions to perform and what information to return.
  • 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.
  • 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#

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#

Building Your First WhatsApp Chatbot

by Jimleuk

View template details
AI agent that can scrape webpages

by Eduard

View template details
Build Your First AI Data Analyst Chatbot

by Solomon

View template details
Browse AI Agent Tool integration templates, or search all templates

Dynamic parameters for tools with $fromAI()#

To learn how to dynamically populate parameters for app node tools, refer to Let AI specify tool parameters with $fromAI().

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.
This page was