Skip to main content

Route user requests to specialized agents with GPT-4o Mini

Workflow preview

Workflow preview
100%
Route user requests to specialized agents with GPT-4o Mini preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

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 descr...

Best for

  • Personal Productivity automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.outputparserautofixing, @n8n/n8n-nodes-langchain.outputparserstructured, n8n-nodes-base.executeworkflow, n8n-nodes-base.switch, @n8n/n8n-nodes-langchain.lmchatopenrouter, n8n-nodes-base.webhook, n8n-nodes-base.respondtowebhook, @n8n/n8n-nodes-langchain.memorypostgreschat

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Dhrumil Patel.

Original n8n.io source

1.1 Workflow description

Title
Route user requests to specialized agents with GPT-4o Mini
Workflow name
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 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


1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Auto-fixing Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserAutofixing - outputParserAutofixing
Config choices
Version 1

Block 2 - Structured Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.2

Block 3 - Reminder Agent

Type / Role
n8n-nodes-base.executeWorkflow - executeWorkflow
Config choices
Version 1.2

Block 4 - Agent Route

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 5 - Output Parser Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 6 - GPT 4o Mini

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 7 - Webhook

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2

Block 8 - Reminder Agent Response

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.1

Block 9 - Email Agent Response

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.1

Block 10 - Email Agent

Type / Role
n8n-nodes-base.executeWorkflow - executeWorkflow
Config choices
Version 1.2

Block 11 - Postgres Chat Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryPostgresChat - memoryPostgresChat
Config choices
Version 1.3

Block 12 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.8

Block 13 - Meeting Agent

Type / Role
n8n-nodes-base.executeWorkflow - executeWorkflow
Config choices
Version 1.2

Block 14 - Meeting Agent Response

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.1

Block 15 - Document Agent

Type / Role
n8n-nodes-base.executeWorkflow - executeWorkflow
Config choices
Version 1.2

Block 16 - Document Agent2

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.1

3. Summary Table

Workflow Route user requests to specialized agents with GPT-4o Mini
Complexity advanced
Nodes 16
Categories Personal Productivity, AI Chatbot
Author Dhrumil Patel
Published 17 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/4150/4150.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Route user requests to specialized agents with GPT-4o Mini do?

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 descr...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Personal Productivity, AI Chatbot use case.