Automate Dynamic AI Agent Conversations with Customizable Roles
Effortlessly orchestrate dynamic multi-agent AI conversations, reducing development complexity and increasing the versatility of your automated chat interactions by over 50%.
Managing multi-agent AI interactions often involves complex routing logic and individual agent setups, leading to cumbersome workflows. This n8n solution streamlines multi-agent conversations by dynamically configuring AI roles, models, and system messages, facilitating intelligent routing and persistent memory for engaging, multi-round dialogues.

Documentation
Orchestrate Dynamic Multi-Agent AI Conversations
This workflow provides a powerful and flexible framework for engaging in multi-agent AI conversations. It allows you to define multiple AI agents, each with unique names, distinct system instructions, and specific Large Language Models (LLMs) from OpenRouter, all within a single, streamlined n8n setup.
Key Features
- Define an unlimited number of AI agents, each with unique names and configurable system messages to tailor their persona and expertise.
- Utilize a diverse range of LLMs through OpenRouter, allowing agents to leverage specific models like GPT-4o, Claude 3.7 Sonnet, or Gemini 2.0 Flash Lite 001 for optimal performance.
- Intelligent agent routing: address specific agents using @mentions in your chat message, or allow the workflow to automatically engage all agents in a randomized order if no mentions are present.
- Maintain continuity across conversations with built-in memory, enabling multi-round dialogues where agents remember previous interactions.
- Streamlined setup: eliminate the need for multiple, complex agent nodes and intricate routing paths, simplifying the management of your AI ecosystem.
How It Works
Upon receiving a chat message, the workflow first retrieves global user settings and your defined AI agents. It then intelligently parses the input message to identify any @mentions of specific agents. If agents are mentioned, only those will be activated, responding in the order they appear. If no agents are mentioned, all defined agents are activated in a random sequence.
Each selected agent then dynamically receives its unique system message, model configuration, and the current conversation input (either the initial user message or the previous agent's response). The AI Agent node processes this information, leveraging a shared memory store for conversational context. Once all activated agents have responded, their individual outputs are combined into a single, comprehensive response delivered back to the user.
Customization & Setup
The power of this workflow lies in its easy customization through two dedicated Code nodes: Define Global Settings and Define Agent Settings.
- Define Global Settings: Personalize the conversation experience by specifying details about the user (e.g., name, location, preferred style) and injecting a 'global' system message that all agents will consider.
- Define Agent Settings: Configure your AI team by adding or removing JSON objects. For each agent, specify their name, the model they should use (following OpenRouter's naming conventions), and a unique systemMessage to dictate their persona and behavior.
The workflow dynamically fetches these settings, ensuring that your AI Agent node automatically adapts its behavior and model based on the active agent in the loop, simplifying complex multi-agent orchestration.