- Add 100 blog posts covering AI, development, and tech topics - Add .env.example for environment configuration - Add accessibility and lighthouse audit scripts - Remove obsolete SEO reports and temporary files - Remove dev-dist build artifacts and backup files - Remove unused portrait images (moved/consolidated elsewhere) - Update contact form and component improvements Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
525 lines
13 KiB
Markdown
525 lines
13 KiB
Markdown
# n8n Workflow Automation mit AI Agents: Production Guide
|
||
|
||
**Meta-Description:** AI-powered Workflows mit n8n aufbauen. Agent-Nodes, LLM-Integration, Human-in-the-Loop und Enterprise-Deployment für skalierbare Automatisierung.
|
||
|
||
**Keywords:** n8n, Workflow Automation, AI Agents, LLM Integration, No-Code AI, Automation Platform, OpenAI n8n, Claude n8n
|
||
|
||
---
|
||
|
||
## Einführung
|
||
|
||
n8n kombiniert **Visual Workflow Building** mit **nativer AI-Unterstützung** – 400+ Integrationen, Self-Hosting-Option und eine 169k+ GitHub Stars Community. 2026 ist es die Go-To-Plattform für AI-Workflow-Automatisierung.
|
||
|
||
> "n8n gibt Teams die Geschwindigkeit von No-Code mit der Flexibilität von echtem Code."
|
||
|
||
---
|
||
|
||
## Warum n8n für AI Workflows?
|
||
|
||
```
|
||
┌─────────────────────────────────────────────────────────────┐
|
||
│ n8n AI CAPABILITIES │
|
||
├─────────────────────────────────────────────────────────────┤
|
||
│ │
|
||
│ Native AI Nodes │
|
||
│ ├── OpenAI (GPT-4, GPT-4o) │
|
||
│ ├── Anthropic (Claude 3.5, Opus) │
|
||
│ ├── Google (Gemini) │
|
||
│ ├── Ollama (Local LLMs) │
|
||
│ └── Custom LLM Endpoints │
|
||
│ │
|
||
│ Agent Framework │
|
||
│ ├── Autonomous Agents │
|
||
│ ├── Tool Integration │
|
||
│ ├── Memory & Context │
|
||
│ └── Multi-Agent Orchestration │
|
||
│ │
|
||
│ 500+ Integrations │
|
||
│ ├── APIs & Webhooks │
|
||
│ ├── Databases │
|
||
│ ├── Cloud Services │
|
||
│ └── Custom Nodes │
|
||
│ │
|
||
└─────────────────────────────────────────────────────────────┘
|
||
```
|
||
|
||
---
|
||
|
||
## AI Agent Node Setup
|
||
|
||
### Basic Agent Workflow
|
||
|
||
```json
|
||
{
|
||
"nodes": [
|
||
{
|
||
"name": "Webhook Trigger",
|
||
"type": "n8n-nodes-base.webhook",
|
||
"parameters": {
|
||
"path": "ai-agent",
|
||
"httpMethod": "POST"
|
||
}
|
||
},
|
||
{
|
||
"name": "AI Agent",
|
||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||
"parameters": {
|
||
"agent": "conversationalAgent",
|
||
"systemMessage": "Du bist ein hilfreicher Assistent für Produktrecherche.",
|
||
"promptType": "define",
|
||
"text": "={{ $json.query }}"
|
||
}
|
||
},
|
||
{
|
||
"name": "Respond to Webhook",
|
||
"type": "n8n-nodes-base.respondToWebhook",
|
||
"parameters": {
|
||
"respondWith": "json",
|
||
"responseBody": "={{ $json }}"
|
||
}
|
||
}
|
||
]
|
||
}
|
||
```
|
||
|
||
### Agent mit Tools
|
||
|
||
```typescript
|
||
// n8n Agent mit Tool-Integration
|
||
const agentConfig = {
|
||
systemMessage: `Du bist ein Research-Agent.
|
||
Du hast Zugriff auf folgende Tools:
|
||
- web_search: Für aktuelle Informationen
|
||
- database_query: Für interne Daten
|
||
- send_email: Für Benachrichtigungen
|
||
|
||
Nutze die Tools strategisch, um Aufgaben zu lösen.`,
|
||
|
||
tools: [
|
||
{
|
||
name: 'web_search',
|
||
description: 'Sucht im Internet nach aktuellen Informationen',
|
||
node: 'HTTP Request'
|
||
},
|
||
{
|
||
name: 'database_query',
|
||
description: 'Führt SQL-Queries gegen die Datenbank aus',
|
||
node: 'PostgreSQL'
|
||
},
|
||
{
|
||
name: 'send_email',
|
||
description: 'Sendet E-Mails an Benutzer',
|
||
node: 'Gmail'
|
||
}
|
||
]
|
||
};
|
||
```
|
||
|
||
---
|
||
|
||
## Praxisbeispiel: Automatisierte Lead-Qualifizierung
|
||
|
||
```yaml
|
||
# Workflow: Lead Qualifizierung mit AI
|
||
trigger:
|
||
- type: webhook
|
||
path: /new-lead
|
||
|
||
steps:
|
||
1_enrich_data:
|
||
node: HTTP Request
|
||
action: Firmendaten von Clearbit abrufen
|
||
|
||
2_ai_analysis:
|
||
node: AI Agent
|
||
prompt: |
|
||
Analysiere diesen Lead:
|
||
Name: {{$json.name}}
|
||
Firma: {{$json.company}}
|
||
Firmendaten: {{$node.enrich_data.json}}
|
||
|
||
Bewerte:
|
||
1. Passt zum ICP? (Ja/Nein)
|
||
2. Budget-Potenzial (1-10)
|
||
3. Dringlichkeit (1-10)
|
||
4. Empfohlene nächste Aktion
|
||
|
||
Antworte im JSON-Format.
|
||
|
||
3_score_check:
|
||
node: IF
|
||
condition: "{{$json.budget_potential >= 7 && $json.urgency >= 5}}"
|
||
|
||
4a_high_priority:
|
||
node: Slack
|
||
action: Nachricht an #sales-hot-leads
|
||
|
||
4b_nurture:
|
||
node: Mailchimp
|
||
action: Zu Nurture-Kampagne hinzufügen
|
||
|
||
5_crm_update:
|
||
node: Salesforce
|
||
action: Lead-Score und AI-Analyse speichern
|
||
```
|
||
|
||
---
|
||
|
||
## Human-in-the-Loop Integration
|
||
|
||
```typescript
|
||
// n8n Workflow mit manueller Genehmigung
|
||
const humanInTheLoopWorkflow = {
|
||
nodes: [
|
||
{
|
||
name: 'AI Draft',
|
||
type: 'AI Agent',
|
||
config: {
|
||
prompt: 'Erstelle einen Vertragsentwurf für: {{$json.deal}}'
|
||
}
|
||
},
|
||
{
|
||
name: 'Wait for Approval',
|
||
type: 'n8n-nodes-base.wait',
|
||
parameters: {
|
||
resume: 'webhook',
|
||
webhookSuffix: 'approval-{{$json.id}}'
|
||
}
|
||
},
|
||
{
|
||
name: 'Approval Check',
|
||
type: 'n8n-nodes-base.if',
|
||
parameters: {
|
||
conditions: {
|
||
boolean: [
|
||
{
|
||
value1: '={{$json.approved}}',
|
||
value2: true
|
||
}
|
||
]
|
||
}
|
||
}
|
||
},
|
||
{
|
||
name: 'Send Contract',
|
||
type: 'n8n-nodes-base.email',
|
||
config: {
|
||
to: '={{$json.customer_email}}',
|
||
subject: 'Ihr Vertrag',
|
||
body: '={{$node["AI Draft"].json.contract}}'
|
||
}
|
||
},
|
||
{
|
||
name: 'Revise Draft',
|
||
type: 'AI Agent',
|
||
config: {
|
||
prompt: `Überarbeite den Vertrag basierend auf Feedback:
|
||
Original: {{$node["AI Draft"].json.contract}}
|
||
Feedback: {{$json.feedback}}`
|
||
}
|
||
}
|
||
]
|
||
};
|
||
```
|
||
|
||
---
|
||
|
||
## Multi-Agent Orchestration
|
||
|
||
```typescript
|
||
// Koordination mehrerer spezialisierter Agents
|
||
const multiAgentWorkflow = {
|
||
name: 'Research Pipeline',
|
||
|
||
agents: {
|
||
researcher: {
|
||
role: 'Recherchiert Informationen zu einem Thema',
|
||
tools: ['web_search', 'arxiv_search'],
|
||
output: 'research_findings'
|
||
},
|
||
|
||
analyst: {
|
||
role: 'Analysiert die Recherche-Ergebnisse',
|
||
input: '{{agents.researcher.output}}',
|
||
tools: ['calculate', 'chart_create'],
|
||
output: 'analysis_report'
|
||
},
|
||
|
||
writer: {
|
||
role: 'Erstellt den finalen Bericht',
|
||
input: '{{agents.analyst.output}}',
|
||
tools: ['format_document', 'add_citations'],
|
||
output: 'final_report'
|
||
},
|
||
|
||
qa: {
|
||
role: 'Prüft den Bericht auf Fehler',
|
||
input: '{{agents.writer.output}}',
|
||
tools: ['fact_check', 'grammar_check'],
|
||
output: 'reviewed_report'
|
||
}
|
||
},
|
||
|
||
flow: 'researcher → analyst → writer → qa'
|
||
};
|
||
```
|
||
|
||
---
|
||
|
||
## LLM-Konfiguration
|
||
|
||
### OpenAI
|
||
|
||
```json
|
||
{
|
||
"name": "OpenAI Chat Model",
|
||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||
"parameters": {
|
||
"model": "gpt-4o",
|
||
"temperature": 0.7,
|
||
"maxTokens": 2000,
|
||
"options": {
|
||
"topP": 0.9,
|
||
"frequencyPenalty": 0,
|
||
"presencePenalty": 0
|
||
}
|
||
},
|
||
"credentials": {
|
||
"openAiApi": "OpenAI API Key"
|
||
}
|
||
}
|
||
```
|
||
|
||
### Anthropic Claude
|
||
|
||
```json
|
||
{
|
||
"name": "Claude Chat Model",
|
||
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
|
||
"parameters": {
|
||
"model": "claude-3-5-sonnet-20241022",
|
||
"temperature": 0.5,
|
||
"maxTokens": 4096
|
||
},
|
||
"credentials": {
|
||
"anthropicApi": "Anthropic API Key"
|
||
}
|
||
}
|
||
```
|
||
|
||
### Ollama (Self-Hosted)
|
||
|
||
```json
|
||
{
|
||
"name": "Ollama Local",
|
||
"type": "@n8n/n8n-nodes-langchain.lmChatOllama",
|
||
"parameters": {
|
||
"model": "llama3.3:70b",
|
||
"baseUrl": "http://localhost:11434"
|
||
}
|
||
}
|
||
```
|
||
|
||
---
|
||
|
||
## Memory & Context Management
|
||
|
||
```typescript
|
||
// Conversation Memory für Agents
|
||
const memoryConfig = {
|
||
// Window Buffer Memory
|
||
windowMemory: {
|
||
type: 'windowBufferMemory',
|
||
windowSize: 10, // Letzte 10 Nachrichten
|
||
sessionKey: 'conversation_{{$json.user_id}}'
|
||
},
|
||
|
||
// Vector Store Memory (für lange Kontexte)
|
||
vectorMemory: {
|
||
type: 'vectorStoreMemory',
|
||
vectorStore: 'pinecone',
|
||
topK: 5,
|
||
embeddings: 'openai-ada-002'
|
||
},
|
||
|
||
// Summary Memory (für sehr lange Gespräche)
|
||
summaryMemory: {
|
||
type: 'summaryBufferMemory',
|
||
maxTokens: 2000,
|
||
llmForSummary: 'gpt-3.5-turbo'
|
||
}
|
||
};
|
||
```
|
||
|
||
---
|
||
|
||
## Error Handling & Retries
|
||
|
||
```json
|
||
{
|
||
"name": "AI Agent with Error Handling",
|
||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||
"parameters": {
|
||
"agent": "toolsAgent"
|
||
},
|
||
"continueOnFail": true,
|
||
"retryOnFail": {
|
||
"enabled": true,
|
||
"maxTries": 3,
|
||
"waitBetweenTries": 5000
|
||
},
|
||
"onError": "continueRegularOutput"
|
||
}
|
||
```
|
||
|
||
### Error Workflow
|
||
|
||
```yaml
|
||
error_handler:
|
||
trigger: On Error
|
||
steps:
|
||
- log_error:
|
||
node: Function
|
||
code: |
|
||
console.error('Workflow failed:', $json.error);
|
||
return { logged: true };
|
||
|
||
- notify_team:
|
||
node: Slack
|
||
message: "⚠️ AI Workflow fehlgeschlagen: {{$json.error.message}}"
|
||
|
||
- fallback_response:
|
||
node: Respond to Webhook
|
||
body:
|
||
success: false
|
||
error: "Wir bearbeiten Ihre Anfrage manuell."
|
||
```
|
||
|
||
---
|
||
|
||
## Deployment Options
|
||
|
||
### Self-Hosted (Docker)
|
||
|
||
```yaml
|
||
# docker-compose.yml
|
||
version: '3.8'
|
||
services:
|
||
n8n:
|
||
image: n8nio/n8n:latest
|
||
environment:
|
||
- N8N_HOST=n8n.yourdomain.com
|
||
- N8N_PORT=5678
|
||
- N8N_PROTOCOL=https
|
||
- NODE_ENV=production
|
||
- WEBHOOK_URL=https://n8n.yourdomain.com/
|
||
- EXECUTIONS_DATA_PRUNE=true
|
||
- EXECUTIONS_DATA_MAX_AGE=168
|
||
- N8N_ENCRYPTION_KEY=${ENCRYPTION_KEY}
|
||
volumes:
|
||
- n8n_data:/home/node/.n8n
|
||
ports:
|
||
- "5678:5678"
|
||
restart: unless-stopped
|
||
|
||
volumes:
|
||
n8n_data:
|
||
```
|
||
|
||
### Performance Tuning
|
||
|
||
```bash
|
||
# Environment Variables für High-Throughput
|
||
N8N_EXECUTIONS_MODE=queue
|
||
N8N_QUEUE_BULL_REDIS_HOST=redis
|
||
N8N_CONCURRENCY_PRODUCTION_LIMIT=20
|
||
|
||
# Für 220+ executions/second
|
||
QUEUE_BULL_REDIS_CLUSTER_NODES=redis1:6379,redis2:6379,redis3:6379
|
||
```
|
||
|
||
---
|
||
|
||
## Kosten-Vergleich
|
||
|
||
| Feature | n8n Self-Hosted | n8n Cloud | Zapier | Make |
|
||
|---------|-----------------|-----------|--------|------|
|
||
| **Basis-Preis** | $0 | $20/mo | $29.99/mo | $10.59/mo |
|
||
| **AI Nodes** | Unlimited | Included | Extra | Extra |
|
||
| **Executions** | Unlimited | 2,500/mo | 750/mo | 10,000/mo |
|
||
| **Self-Hosting** | Ja | Nein | Nein | Nein |
|
||
| **Custom Code** | Ja | Ja | Limited | Ja |
|
||
|
||
---
|
||
|
||
## Best Practices
|
||
|
||
### 1. Modularisierung
|
||
|
||
```yaml
|
||
# Wiederverwendbare Sub-Workflows
|
||
main_workflow:
|
||
steps:
|
||
- call: enrichment_subworkflow
|
||
input: "{{$json.lead}}"
|
||
|
||
- call: ai_analysis_subworkflow
|
||
input: "{{$json.enriched_data}}"
|
||
|
||
- call: notification_subworkflow
|
||
input: "{{$json.analysis}}"
|
||
```
|
||
|
||
### 2. Rate Limiting
|
||
|
||
```typescript
|
||
// Für API-intensive Workflows
|
||
const rateLimitedNode = {
|
||
name: 'OpenAI Call',
|
||
settings: {
|
||
maxConcurrency: 5, // Max parallele Calls
|
||
delayBetweenRequests: 100, // ms zwischen Requests
|
||
timeout: 30000 // 30s Timeout
|
||
}
|
||
};
|
||
```
|
||
|
||
### 3. Secrets Management
|
||
|
||
```bash
|
||
# Credentials niemals hardcoden
|
||
N8N_CREDENTIALS_OVERWRITE_FILE=/secrets/credentials.json
|
||
N8N_CREDENTIALS_DEFAULT_NAME=production
|
||
```
|
||
|
||
---
|
||
|
||
## Fazit
|
||
|
||
n8n für AI Workflows bietet:
|
||
|
||
1. **Native LLM-Integration**: OpenAI, Claude, Ollama out-of-the-box
|
||
2. **Agent Framework**: Multi-Agent-Orchestration mit Tools
|
||
3. **Human-in-the-Loop**: Genehmigungsschritte für kritische Aktionen
|
||
4. **Self-Hosting**: Volle Datenkontrolle, keine Vendor Lock-in
|
||
|
||
Mit 600+ Community-Templates ist der Einstieg schnell – und die Skalierung kosteneffizient.
|
||
|
||
---
|
||
|
||
## Bildprompts
|
||
|
||
1. "Workflow diagram with AI nodes glowing, visual automation builder, clean interface design"
|
||
2. "Multiple AI agents working together in pipeline, assembly line concept, modern tech illustration"
|
||
3. "n8n logo transforming into intelligent automation, nodes connecting, futuristic workflow"
|
||
|
||
---
|
||
|
||
## Quellen
|
||
|
||
- [n8n AI Workflow Automation](https://n8n.io/ai/)
|
||
- [n8n AI Agents Documentation](https://n8n.io/ai-agents/)
|
||
- [n8n GitHub Repository](https://github.com/n8n-io/n8n)
|
||
- [HatchWorks n8n Guide 2026](https://hatchworks.com/blog/ai-agents/n8n-guide/)
|
||
- [n8n AI Workflow Templates](https://n8n.io/workflows/categories/ai/)
|