π€ Intelligent Travel Planning with Multi-Agent AI Orchestration
An intelligent, self-orchestrating workflow that demonstrates how to build LLM-powered agents using n8n as the orchestration engine. This project showcases task decomposition, specialist routing, and result synthesis - all with minimal code and maximum modularity.
The Agentic Travel Planner takes complex user requests and intelligently breaks them down into specialized subtasks, routes each task to the appropriate AI specialist, and synthesizes the results into a comprehensive, actionable plan.
User Request: "Plan a weekend trip to San Francisco"
β
[Task Decomposer]
β
Activities | Accommodation | Dining | Transportation
β
[Specialist Agents Process in Parallel]
β
[Plan Synthesizer]
β
Complete Weekend Itinerary
π Visual Flow Diagram: See
workflow-diagram.mdfor the complete visual representation
- π Webhook Trigger - Receives user requests via HTTP POST
- β Input Validation - Ensures proper request format
- π§ Task Decomposer - OpenAI breaks down complex requests
- π― Task Router - Routes subtasks to specialized agents
- π€ Specialist Agents - Five specialized OpenAI agents:
- Activities Agent πͺ
- Accommodation Agent π¨
- Dining Agent π½οΈ
- Transportation Agent π
- General Agent π οΈ
- π Results Collector - Aggregates all specialist responses
- πΌ Plan Synthesizer - Creates cohesive final plan
- π Response Formatter - Structures output with metadata
- π Execution Logger - Logs performance and completion stats
- Modularity: Each specialist agent has a specific domain of expertise
- Scalability: Easy to add new specialist agents or modify existing ones
- Parallel Processing: Multiple agents work simultaneously for faster results
- Error Handling: Input validation and fallback mechanisms
- Observability: Comprehensive logging and request tracking
- Flexibility: Handles diverse request types through intelligent routing
- n8n instance (cloud or self-hosted)
- OpenAI API key
- Basic understanding of n8n workflows
-
Import the Workflow
# Copy the agentic-workflow.json content # In n8n: Workflows β Import from File β Paste JSON
-
Configure OpenAI Credentials
# In n8n: Settings β Credentials β Add Credential # Type: OpenAI # Name: "OpenAI API" # API Key: your-openai-api-key
-
Activate the Workflow
# In n8n: Toggle the workflow to "Active" # Note the webhook URL (usually ends with /travel-agent)
OpenAI Models: Currently set to GPT-4, but can be changed to:
gpt-3.5-turbo(faster, cheaper)gpt-4-turbo(more capable)gpt-4o(latest model)
Temperature Settings:
- Task Decomposer: 0.3 (more deterministic)
- Specialist Agents: 0.7 (more creative)
- Plan Synthesizer: 0.5 (balanced)
POST https://your-n8n-instance.com/webhook/travel-agent
Content-Type: application/json
{
"request": "Your planning request here"
}{
"success": true,
"request_id": "unique-request-identifier",
"original_request": "Plan a weekend trip to San Francisco",
"plan": "# Complete formatted plan with sections and details",
"completion_time": "2024-01-01T10:15:30.000Z",
"tasks_processed": 4
}{
"success": false,
"error": "Invalid request. Please provide a 'request' field in the request body.",
"example": {
"request": "Plan a weekend trip to San Francisco"
}
}curl -X POST https://your-n8n-webhook-url/travel-agent \
-H "Content-Type: application/json" \
-d '{
"request": "Plan a weekend trip to San Francisco"
}'curl -X POST https://your-n8n-webhook-url/travel-agent \
-H "Content-Type: application/json" \
-d '{
"request": "Organize a tech conference for 200 people in Austin, Texas"
}'curl -X POST https://your-n8n-webhook-url/travel-agent \
-H "Content-Type: application/json" \
-d '{
"request": "Help me plan a romantic dinner date in Paris"
}'-
Add New Task Type in Task Router:
{ "conditions": { "string": [ { "value1": "={{$json.task_type}}", "value2": "your_new_type" } ] }, "output": 5 } -
Create New Agent Node:
{ "parameters": { "resource": "chat", "operation": "create", "model": "gpt-4", "messages": { "values": [ { "role": "system", "content": "You are a [specialty] specialist. [Instructions]" } ] } }, "name": "Your New Agent" } -
Connect to Results Collector
System Prompts: Edit the system role content in each specialist agent
Response Format: Modify prompts to request specific output formats (JSON, markdown, etc.)
Temperature: Adjust for more/less creative responses
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json.error}}",
"operation": "isNotEmpty"
}
]
}
},
"name": "Error Check",
"type": "n8n-nodes-base.if"
}- Request ID: Unique identifier for tracking
- Execution Time: Performance monitoring
- Task Count: Number of subtasks processed
- Status Tracking: Request lifecycle monitoring
{
"timestamp": "2024-01-01T10:15:30.000Z",
"request_id": "1_1704067200000",
"original_request": "Plan a weekend trip to San Francisco",
"status": "completed",
"tasks_processed": 4,
"execution_time_ms": 15430
}- Database Storage: Add a database node after Execution Logger
- Webhook Notifications: Send logs to external monitoring systems
- File Storage: Write logs to persistent storage
Keep the visual diagram in sync with workflow changes:
# Validate diagram consistency
python update-diagram.py --validate
# Generate workflow summary
python update-diagram.py --summaryOpenAI API Errors:
- Check API key validity
- Verify account credits/usage limits
- Ensure model access permissions
Webhook Not Responding:
- Confirm workflow is activated
- Check webhook URL is correct
- Verify n8n instance is running
Task Decomposition Failures:
- Check OpenAI response format
- Review Task Parser error handling
- Adjust system prompt clarity
Agent Response Issues:
- Monitor individual agent responses
- Adjust temperature settings
- Refine specialist system prompts
Enable debug mode in n8n to see detailed execution logs and intermediate results.
Add a memory node to store conversation history:
{
"parameters": {
"operation": "create",
"resource": "item",
"additionalFields": {
"memory": "={{$json.conversation_history}}"
}
}
}Add smart routing based on request complexity:
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json.user_request.length}}",
"operation": "larger",
"value2": "100"
}
]
}
}
}Connect real APIs for live data:
{
"parameters": {
"url": "https://api.external-service.com/search",
"method": "GET",
"qs": {
"query": "={{$json.search_term}}"
}
},
"name": "External API Call",
"type": "n8n-nodes-base.httpRequest"
}- Use
gpt-3.5-turbofor faster responses when accuracy isn't critical - Implement caching for common requests
- Add request queuing for high-volume usage
- Implement API key authentication
- Add rate limiting
- Sanitize user inputs
- Use HTTPS for webhook endpoints
- Deploy n8n with clustering
- Use load balancing for webhook endpoints
- Consider async processing for complex requests
- Task Decomposition Strategies
- Agent Orchestration Patterns
- LLM Prompt Engineering
- Multi-Agent System Design
Feel free to extend this workflow with:
- New specialist agents
- Enhanced error handling
- Better logging mechanisms
- Integration with additional APIs
- Performance optimizations
This project is open source and available under the MIT License.
This project is ready to be pushed to GitHub:
# Create a new repository on GitHub, then:
git remote add origin https://github.com/yourusername/n8n-travel-planner-agentic-workflow.git
git push -u origin mainRepository Features:
- β
Complete project structure with proper
.gitignore - β MIT License and contribution guidelines
- β Package.json with npm scripts for testing
- β Automated diagram validation utilities
- β Comprehensive documentation and examples
π Ready to build your own agentic workflows?
Import the workflow, configure your OpenAI credentials, and start experimenting with intelligent task orchestration!