Route AI tasks with OpenAI GPT‐4.1‐mini and confidence‐based email fallback
Workflow preview
$20/month : Unlimited workflows
2500 executions/month
THE #1 IN WEB SCRAPING
Scrape any website without limits
HOSTINGER
Early Deal
DISCOUNT 20% Try free
DISCOUNT 20%
Self-hosted n8n
Unlimited workflows - from $4.99/mo
#1 hub for scraping, AI & automation
6000+ actors - $5 credits/mo
Overview
Overview
This workflow intelligently routes incoming user requests using AI-powered task classification. It determines whether a task is simple or complex, assigns a confidence score, and dynamically delegates execution to the appropriate agent.
If the confidence score is too low, the workflow triggers a fallback email alert for manual review—ensuring reliability and preventing incorrect automation.
This design improves response accuracy, enables scalable automation, and introduces human-in-the-loop safety for uncertain scenarios.
How It Works
- Webhook Trigger
- Receives incoming user requests.
- Workflow Configuration
- Stores the user request and confidence threshold.
- Supervisor Agent
- Analyzes the request.
- Classifies it as
simpleorcomplex. - Returns a confidence score and reasoning.
- Structured Output Parser
- Ensures the classification follows a strict JSON format.
- Confidence Check (IF Node)
- Compares the confidence score with the threshold.
- Routing Logic
- If confidence is high:
- Task is passed to the Executor Agent
- Executor selects:
- Simple Agent Tool for basic tasks
- Complex Agent Tool for advanced tasks
- Agent Execution
- Each agent uses an OpenAI model to process the task.
- Fallback Handling
- If confidence is low:
- Sends an email alert for human review.
Setup Instructions
- OpenAI Credentials
- Add credentials for all OpenAI nodes:
- Supervisor
- Executor
- Simple Agent
- Complex Agent
- Webhook Configuration
- Set the webhook path.
- Connect it to your frontend or API source.
- Email Node Setup
- Configure sender and recipient email addresses.
- Use SMTP or supported email service.
- Adjust Threshold
- Modify
confidenceThresholdin the Set node if needed.
- Customize Prompts
- Update system messages in:
- Supervisor Agent
- Executor Agent
- Simple/Complex Agents
Use Cases
- AI-powered task routing systems
- Customer support automation with fallback safety
- Intelligent chatbot orchestration
- Workflow automation with human-in-the-loop validation
- Multi-agent AI systems with decision control
Requirements
- OpenAI API credentials
- Email (SMTP or service integration)
- n8n instance (cloud or self-hosted)
Key Features
- AI-based task classification
- Confidence scoring for safe automation
- Dynamic agent routing
- Human fallback for low-confidence decisions
- Modular and scalable architecture
Summary
A smart AI routing workflow that classifies tasks, routes them to specialized agents, and ensures reliability through confidence scoring and fallback alerts—ideal for building safe, scalable automation systems in n8n.