AI agent for n8n workflow automation
An AI-powered CLI assistant that helps you build n8n workflows through natural language. Describe what you want to automate, and it generates, validates, and can deploy workflows directly to your n8n instance.
n8nCopilot/
├── src/
│ ├── config/ # Model configuration
│ ├── tools/ # Agent tools (todos, memory, workflow, search)
│ ├── prompt/ # System prompts
│ ├── ui/ # CLI UI components
│ ├── memory/ # 3-layer memory system
│ └── index.ts # Entry point
├── .n8ncopilot/ # Runtime memory storage
└── package.json
# Clone
npm install
# Copy and configure env
cp .env.example .env
# Edit .env with your values
# Run
npm start
# or: bun index.ts
# or: npx tsx index.tsn8nCopilot works with any LangChain-compatible model:
| Provider | Setup |
|---|---|
| Ollama (local, free) | ollama serve then select model like qwen2.5:14b |
| OpenAI | Set OPENAI_API_KEY in .env |
| Anthropic | Set ANTHROPIC_API_KEY in .env |
| Groq | Set GROQ_API_KEY in .env |
Switch model anytime: type /model in the chat.
Recommended models:
qwen2.5:14b(Ollama) — best for JSON generation locallygpt-4o(OpenAI) — most reliable tool callingclaude-sonnet-4-5-20251022(Anthropic) — best planningllama-3.3-70b-versatile(Groq) — fastest open model
you › Build a webhook that receives Stripe payments and saves to Postgres with Slack alerts on failure
◆ Planning...
⟳ write_todos({"tasks":["Search Stripe + Postgres + Slack nodes","Generate workflow","Validate","Add error handling"]})
✓ write_todos: Plan created (4 steps)
⟳ generate_workflow({"description":"Stripe webhook → Postgres → Slack alerts","trigger":"webhook",...})
✓ generate_workflow: Generated "Stripe Payment Processor" — 8 nodes
⟳ validate_workflow({...})
✓ validate_workflow: ✅ 0 errors · 1 warning · 8 nodes
Generated workflow: Stripe Payment Processor
• 8 nodes • webhook trigger • Postgres + Slack
• Full error handling with Slack notifications
• continueOnFail on all external nodes
Copy the JSON below or type "deploy this" to push to your n8n instance.
| Command | Description |
|---|---|
/model |
Switch model provider |
/memory |
View long-term memory state |
/todos |
View current plan |
/clear |
Clear screen |
/help |
Show help |
/exit |
Quit |
n8nCopilot
├── DeepAgent Core (LangGraph createReactAgent)
│ ├── Planning: write_todos / read_todos / update_todo
│ ├── Memory: save_memory / read_memory / list_memory
│ └── Context: set_project_context
├── n8n Knowledge
│ ├── search_nodes (40+ nodes catalog)
│ └── generate_workflow (sub-call with n8n expert prompt)
├── Workflow Pipeline
│ ├── generate_workflow → validate_workflow → add_error_handling
│ └── deploy_workflow / list_workflows (n8n API)
├── 3-Layer Memory System
│ ├── Layer 1: .n8ncopilot/memory/index.json (always loaded)
│ ├── Layer 2: .n8ncopilot/memory/topics/*.json (on-demand)
│ └── Layer 3: .n8ncopilot/memory/feedback.json (grep only)
├── Streaming (dim tool call display)
└── Feedback Learning (thumbs up/down → memory)
To enable direct deployment:
- Open n8n → Settings → API
- Create an API key
- Add to
.env:N8N_API_URL=http://localhost:5678 N8N_API_KEY=your_key_here
Rahees Ahmed