Multi-Agent Routing System for AI Task Delegation - n8n Workflow

Create a powerful n8n workflow using specialized AI agents for automatic task delegation. Route user instructions seamlessly between Email Writing and Data Analysis sub-agents powered by OpenAI models.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • AI Developers & Architects: Those looking to build complex, specialized AI systems within n8n.- Automation Engineers: Users wanting to leverage the LangChain capabilities within n8n to delegate tasks based on intent.- Productivity Experts: Individuals seeking advanced n8n templates to streamline knowledge work and communication.

Overview

This sophisticated n8n workflow solves the problem of creating generalist AI assistants that often fail at specific, specialized tasks. By implementing a hierarchical multi-agent structure, this n8n solution ensures that complex requests are delegated to the appropriate expert 'tool' (sub-agent). This architecture significantly enhances accuracy and efficiency, whether the task is drafting a professional follow-up email or summarizing key business metrics. This n8n template demonstrates best practices for building scalable AI automation flows, using separate language models and memory pools for each agent to maintain focus and context. Every n8n node is configured for optimal performance.

How it Works

This n8n workflow operates as a highly specialized routing system:


  1. Initial Request: The process begins when a user prompt enters the ManagerAgent (Routing + Instruction Generator) n8n node (often triggered by an upstream n8n trigger like a Chat Trigger or Webhook).

  2. Manager Analysis: The ManagerAgent, equipped with a comprehensive system message, analyzes the input. Its primary job is to determine if the task requires writing an email (EmailAgent) or analyzing data/metrics (DataAgent).

  3. Delegation (Routing): Based on the analysis, the ManagerAgent refines the instruction and delegates the task to the relevant specialized Agent Tool.

  4. Email Delegation: If an email is required, the instruction is passed to the EmailAgent (Communication Specialist) n8n node. This agent, using its dedicated LLM and specific 'professional writer' system prompt, generates only the polished email content.

  5. Data Delegation: If data insight is required, the instruction is passed to the DataAgent (Insight Generator) n8n node. This agent performs the summary or analysis.

  6. Context Maintenance: Each agent uses a dedicated Simple Memory n8n node, ensuring conversation context is maintained within its specific domain, preventing cross-contamination of logic. All agents are powered by dedicated OpenAI Chat Model n8n nodes, ensuring high performance.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


  1. Import: Copy the provided n8n workflow JSON code.

  2. Open n8n: Navigate to your n8n instance and create a new workflow.

  3. Import JSON: Click the 'Import Workflow' option and paste the JSON data.

  4. Credential Setup: This n8n template relies heavily on OpenAI. You must configure the required credentials for the OpenAI Chat Model n8n nodes. Click on any of the 'OpenAI Chat Model' nodes.

Select or create a new 'OpenAi Api' credential, entering your API key. Since multiple nodes share the same credential ID, setting it up once should apply across all three language model nodes.

  1. Execution: Since this flow lacks an explicit n8n trigger, you can test it by manually executing the workflow and providing a prompt to the ManagerAgent.

Node Details

ManagerAgent (Routing + Instruction Generator) (Type: Agent n8n node):
Function: Acts as the central nervous system. It analyzes the user request and decides whether to route the detailed instruction to the EmailAgent or the DataAgent.
Key Configuration: System Message explicitly defines the two subordinate agents and their respective roles (email writing vs. data analysis).
EmailAgent (Communication Specialist) (Type: Agent Tool n8n node):
Function: Specialized sub-agent dedicated solely to professional email writing.
Key Configuration: Uses a system message ensuring a 'warm, business-appropriate tone' and outputs only the email content.
DataAgent (Insight Generator) (Type: Agent Tool n8n node):
Function: Specialized sub-agent responsible for handling instructions requiring metrics, summaries, or data analysis.
Key Configuration: Tool Description clearly states its role in data insight generation.
OpenAI Chat Model Nodes (x3) (Type: Langchain Chat Model n8n node):
Function: Provide the underlying Generative AI capability (using gpt-4o-mini) to the Manager Agent and both Sub-Agents.
Simple Memory Nodes (x3) (Type: Langchain Memory Buffer n8n node):
* Function: Each memory n8n node provides independent conversational context (chat history) for its corresponding Agent, ensuring they stay focused on their current tasks without cross-talk or confusion.

Related n8n Workflows

Free

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.

Featured*