n8n AI Agent Complete Tutorial: Build Automation Workflows from Zero (2026)
n8n is the #1 open source AI workflow platform with 196K GitHub stars. This complete Chinese tutorial walks you through 6 hands-on examples — from email auto-reply to multi-agent collaboration — all running self-hosted and free.
💡 What You Will Learn
n8n is the #1 open source AI workflow platform with 196K GitHub stars. This complete Chinese tutorial walks you through 6 hands-on examples — from email auto-reply to multi-agent collaboration — all r
---
- OpenAI (GPT-4o, GPT-4.1)
- Anthropic Claude (Opus, Sonnet)
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n
You are a professional email assistant. Analyze incoming emails and generate professional, polite reply drafts. Keep it concise, under 200 characters.
5 - []
User Input → AI Agent (Researcher) → Code Node (Clean Data) → AI Agent (Writer) → Output
{
"agent": "Researcher",
"tools": ["Web Search", "HTTP Request"],
"systemPrompt": ""
}
//
const research = $input.first().json.data;
const cleaned = research.output
.replace(/\[\d+\]/g, '') //
.split('\n')
.filter(line => line.trim().length > 0);
return [{ json: { cleanedNotes: cleaned.join('\n') } }];
{
"agent": "Writer",
"tools": [],
"systemPrompt": " 500 Use"
}
Schedule (7:00) →
├─ HTTP Request (Fetch News API) →
├─ AI Agent (Summarize) →
├─ Code Node (Format) →
└─ Slack + Email (Publish)
const summary = $input.first().json.summary;
const date = new Date().toLocaleDateString('zh-TW');
const formatted = `# 📰 AI - ${date}\n\n${summary}\n\n---\n* n8n AI Agent *`;
return [{ json: { formatted, subject: `AI ${date}` } }];
flowchart LR
A[Webhook] --> B[AI Agent<br/>→]
B --> C[Code Node<br/>]
C --> D[AI Agent<br/>→]
D --> E[Code Node<br/>]
E --> F[Notion<br/>]
const items = $input.all();
const zh = items[0].json.translated;
const en = items[1].json.translated;
const ja = items[2].json.translated;
return [{
json: {
original: items[0].json.original,
zh, en, ja,
generatedAt: new Date().toISOString()
}
}];
Input →
Agent: Strategy Planner →
├─ Agent: Researcher →
├─ Agent: Data Analyst →
└─ Agent: Writer →
Aggregate Output
# n8n Docker Ollama
docker run -d --name ollama \
-v ollama:/root/.ollama \
-p 11434:11434 \
ollama/ollama
#
docker exec ollama ollama pull qwen2.5-coder:7b
| n8n | Dify | Flowise | Zapier | |
|---|---|---|---|---|
| GitHub Stars | 196K | 148K | 54K | |
| ✅ | ✅ | ✅ | ❌ | |
| ✅ | ✅ | ✅ | ❌ | |
| AI Agent | ✅ | ✅ | ✅ | ⚠️ |
| ✅ | ⚠️ 50+ | ⚠️ 100+ | ✅ 5000+ | |
| ✅ | ✅ | ✅ | ❌ | |
| --- | ||||
| --- | ||||
| :--------- | :------ | :-------------- | ||
| --- |
Related Articles
2026-07-25
Best Ai Grammar Checker Free in 2026: Top 10 Tools Compared
2026-08-13
AI Essay Writer With Citations 2026: 6 Research Tools That Show Their Sources
2026-08-23
Best AI Resume Builder in Pune 2026: 6 Tools for Engineering Grads and IT Job Seekers
Written by our editorial team; tools listed here are tested or verified against public sources. Links point to official sites or GitHub repos for reference only — no paid placements.
