AI Workflow Generator for n8n is a self-healing AI automation system that generates importable n8n workflows from natural language requests.
The project combines:
- LLM-powered workflow generation
- Deterministic JSON validation
- Conditional repair orchestration
- Recursive revalidation
- Deterministic repair layers
- RAG-based workflow ingestion pipelines
The system was designed to solve a real problem encountered when generating n8n workflows with LLMs:
LLM-generated workflows frequently contain malformed JSON, invalid escaping, broken expressions, or non-importable structures.
This project introduces a validation and repair architecture that attempts to automatically detect and repair those failures before the workflow reaches the final user.
The platform is divided into two modular workflows:
- AI Workflow Generator for n8n
- Workflow Knowledge Ingestion Pipeline
This separation improves maintainability, scalability, and architectural clarity.
Natural language requests are converted into structured importable n8n workflows using Anthropic Claude.
Example request:
Create an n8n workflow that receives a webhook, extracts a customer email from the payload, sends a Slack notification, and stores the data in Google Sheets.
The system generates:
- nodes
- connections
- settings
- sticky notes
- validation-safe expressions
- importable workflow JSON
The system validates generated workflows before considering them complete.
Validation stages include:
- JSON syntax validation
- required field validation
- semantic workflow validation
- malformed expression detection
- responseBody escaping validation
If validation fails:
- The workflow is routed into a repair pipeline
- The repair agent attempts correction
- The repaired workflow is revalidated
- Deterministic repair logic is applied if needed
This creates a hybrid AI + deterministic correction system.
The Validation Router determines whether generated workflows:
- pass validation immediately
- or require repair orchestration
This creates conditional execution behavior similar to production AI orchestration systems.
The repair system contains:
- AI repair orchestration
- recursive validation
- deterministic field repair
- safe JSON correction logic
The deterministic repair layer specifically targets malformed workflow expressions that are commonly produced by LLMs.
The repository includes a fully generated and importable example workflow:
- Webhook trigger
- Slack notification
- Google Sheets storage
- JSON webhook response
- Documentation sticky notes
This demonstrates the end-to-end generation pipeline.
The ingestion workflow provides retrieval augmentation support.
Pipeline:
- Google Drive watches for uploaded workflow templates
- Documents are loaded and processed
- OpenAI embeddings are generated
- Embeddings are stored in Pinecone
- The vector database becomes searchable workflow context
This enables future RAG expansion for:
- workflow examples
- reusable templates
- node configuration retrieval
- semantic workflow assistance
AI-Workflow-Generator-for-n8n/
│
├── README.md
├── LICENSE
├── .gitignore
│
├── workflows/
│ ├── ai-workflow-generator.json
│ ├── workflow-knowledge-ingestion.json
│ └── generated-webhook-slack-sheets-example.json
│
├── screenshots/
│ ├── hero-workflow-overview.png
│ ├── self-healing-architecture.png
│ ├── validation-router.png
│ ├── repair-pipeline.png
│ ├── successful-generated-workflow.png
│ └── ingestion-pipeline.png
- n8n
- Anthropic Claude
- OpenAI Embeddings
- Pinecone
- AI Agents
- RAG Pipelines
- Validation Systems
- Self-Healing Architectures
- Workflow Automation
- Deterministic Repair Layers
- Prompt Engineering
- JSON Validation
File:
examples/customer-webhook-payload.json
{
"email": "customer@example.com",
"name": "John Doe"
}- Open n8n
- Go to Workflows
- Click Import from File
- Select any workflow JSON file from the workflows/ directory
- Configure credentials
- Save and activate the workflow
Depending on the workflow used, configure:
- Anthropic API
- OpenAI API
- Pinecone API
- Google Drive OAuth2
- Google Sheets OAuth2
- Slack API
All exported workflows were sanitized for public release.
No real credentials, IDs, webhook identifiers, or production metadata are included.
This project demonstrates:
- AI orchestration systems
- multi-stage validation pipelines
- recursive repair loops
- deterministic AI guardrails
- hybrid AI + rules-based correction
- modular RAG architecture
- production-style workflow engineering
Potential future enhancements:
- automatic workflow deployment via n8n API
- multi-agent generation systems
- advanced semantic validation
- node compatibility verification
- workflow simulation before import
- vector search ranking improvements
- workflow analytics dashboards
- multi-model repair orchestration
Boris Villanueva
GitHub:





