Route user requests to specialized agents with GPT-4o Mini
This n8n workflow template is designed to route user input to specialized agents (like a Reminder Agent, Email Agent, etc.) using a structured output from a ...
🔌 Nodes & Integrations Used (5)
📖 Implementation & Setup Guide
This **n8n workflow template** is designed to **route user input to specialized agents** (like a Reminder Agent, Email Agent, etc.) using a **structured output from a language model**. Here's a complete description of what it does and how each part works:
---
🔁 **Workflow Purpose:**
This template receives a user's request via **Webhook**, processes it using an **LLM**, extracts structured data like the agent name and user query, and routes the input to the appropriate sub-workflow (agent) based on the specified agent type.
---
🧩 **Workflow Breakdown:**
#### 1. **Webhook (Trigger)**
* Node: `Webhook` * Purpose: Accepts a POST request from any frontend or API source. It contains the **raw user input**.
---
#### 2. **GPT Model (LLM Inference)**
* Node: `GPT 4o Mini` * Purpose: Interprets the user input and determines:
* Which **agent** should handle it (e.g., "Reminder Agent", "Email Agent", etc.) * The **actual user request** (in structured format)
---
#### 3. **Auto-Fixing Output Parser**
* Node: `Auto-fixing Output Parser` * Purpose: Ensures that the output from the LLM matches the expected structure. If there's a mismatch, it automatically corrects it using a re-prompt.
---
#### 4. **Structured Output Parser**
* Node: `Structured Output Parser` * Purpose: Converts the language model's response into a **strict JSON structure** with keys like:
* `"Agent Name"` * `"user input"` * `"sessionID"`
---
#### 5. **Agent Router**
* Node: `Switch ("Agent Route")` * Purpose: Based on `"Agent Name"`, it routes the input to one of the following sub-workflows:
* 📅 `Reminder Agent` * 📧 `Email Agent` * 🧾 `Document Agent` * 🤝 `Meeting Agent`
---
#### 6. **Sub-Workflow Call (Execute Workflow)**
Each agent is implemented as a separate n8n workflow:
* The input is forwarded to the selected agent. * For example, if `"Agent Name"` is `"Reminder Agent"`, the workflow `"Reminder Agent"` is called with `"user input"`.
---
#### 7. **Webhook Response**
* After the sub-agent workflow finishes, a `Respond to Webhook` node sends the output back as an HTTP response.
---
✅ **Key Features:**
* Fully modular and extensible * LLM-driven routing using **OpenRouter GPT-4o** * Auto-corrects structured output errors * Clean separation of concerns (agent logic is decoupled in sub-workflows) * Easily add more agents by updating the switch logic
---
📦 **Use Case Examples:**
* User says: “Remind me to call my mom tomorrow.” → Routed to **Reminder Agent**
* User says: “Send an email to the HR team.” → Routed to **Email Agent**
* User says: “Schedule a meeting with John next week.” → Routed to **Meeting Agent**
---
⚡ How to import this workflow into n8n:
- Click the Direct Download JSON button above to save
Route user requests to specialized agents with GPT-4o Mini.json. - Log in to your n8n Cloud or self-hosted n8n instance.
- In your workflow canvas, click the menu in top-right and select Import from File (or paste the JSON directly).
- Configure your credentials (e.g. API keys, database URLs) in the corresponding node settings.
- Click Execute Workflow to test and switch to Active!
Related AI Agents Workflows
View All in AI Agents →5 ways to process images PDFs with Gemini AI in n8n
How it works Many users have asked in the support forum about different methods to analyze images and PDF documents with Google Gemini AI in n8n. This workfl...
7 AI Sales Assistant
Production-ready n8n automation template for 7 AI Sales Assistant built by AhiXLight. Seamlessly connects Airtop Tool, Slack, Airtop with 24 configured nodes.
AAVE portfolio professional AI agent Telegram Email GPT 4o
A next-generation AI-powered DeFi health monitor that tracks wallet positions across Aave V3 using GPT-4o and LangChain. It delivers human-readable reports v...
Access control for AI agents RBAC using Airtable and Telegram
Purpose This workflow allows granular control over the access to tools connected to AI Agents (including Multi-Agent setups) using Role Based Access Control....