Add 3 missing AI agent workflows: Saraswati, Ganesha, and Hanuman
Co-authored-by: ambicuity <44251619+ambicuity@users.noreply.github.com>
This commit is contained in:
@@ -7,12 +7,19 @@ This repository contains complete, executable n8n workflow JSON files for a mult
|
||||
## Files Included
|
||||
|
||||
### Main Export File
|
||||
- **`workflows-export.json`** - Single JSON file containing all 4 workflows in the required format with a `files` array
|
||||
- **`workflows-export.json`** - Single JSON file containing all 7 workflows in the required format with a `files` array
|
||||
|
||||
### Individual Workflow Files
|
||||
- **`workflows/agents/vishnu-cto.json`** - CTO Orchestrator Agent
|
||||
- **`workflows/agents/brahma-network.json`** - Network Administrator Agent
|
||||
- **`workflows/agents/shiva-devops.json`** - DevOps Engineer Agent
|
||||
|
||||
**AI Agent Workflows:**
|
||||
- **`workflows/agents/vishnu-cto.json`** - CTO Orchestrator Agent (Preservation)
|
||||
- **`workflows/agents/brahma-network.json`** - Network Administrator Agent (Creation)
|
||||
- **`workflows/agents/shiva-devops.json`** - DevOps Engineer Agent (Transformation)
|
||||
- **`workflows/agents/saraswati-database.json`** - Database Administrator Agent (Knowledge)
|
||||
- **`workflows/agents/ganesha-security.json`** - Security Engineer Agent (Problem-Solving)
|
||||
- **`workflows/agents/hanuman-helpdesk.json`** - Helpdesk Support Agent (Service)
|
||||
|
||||
**Utility Workflows:**
|
||||
- **`workflows/utilities/approval-handler.json`** - Human-in-the-Loop Approval Handler
|
||||
|
||||
## Workflow Details
|
||||
@@ -83,7 +90,76 @@ This repository contains complete, executable n8n workflow JSON files for a mult
|
||||
- Conditional execution based on system state
|
||||
- Notifications for success/blocked deployments
|
||||
|
||||
### 4. Approval Handler (approval-handler.json)
|
||||
### 4. Saraswati Database Agent (saraswati-database.json)
|
||||
|
||||
**Role:** Database Administrator and Knowledge Keeper
|
||||
**Trigger:** Schedule (Every 30 minutes)
|
||||
**Version:** 1.0
|
||||
|
||||
**Nodes:**
|
||||
- Schedule Trigger - Every 30 min
|
||||
- HTTP Request - Database Status (checks `http://postgres.local:5432`)
|
||||
- Execute Command - Query Analysis (PostgreSQL diagnostics)
|
||||
- Code - Combine Database Data
|
||||
- AI Agent - Saraswati Database (analyzes results)
|
||||
- Telegram - Database Report (sends notifications)
|
||||
|
||||
**Key Features:**
|
||||
- Scheduled database monitoring every 30 minutes
|
||||
- Database health checks via HTTP
|
||||
- Query performance analysis
|
||||
- Slow query detection
|
||||
- AI-powered optimization recommendations
|
||||
- Reports via Telegram
|
||||
|
||||
### 5. Ganesha Security Agent (ganesha-security.json)
|
||||
|
||||
**Role:** Security Engineer and Obstacle Remover
|
||||
**Trigger:** Schedule (Every 10 minutes)
|
||||
**Version:** 1.0
|
||||
|
||||
**Nodes:**
|
||||
- Schedule Trigger - Every 10 min
|
||||
- Execute Command - Auth Logs (checks failed login attempts)
|
||||
- Execute Command - Fail2ban Status
|
||||
- Execute Command - Certificate Check (SSL/TLS expiration)
|
||||
- Code - Combine Security Data
|
||||
- AI Agent - Ganesha Security (threat analysis)
|
||||
- Telegram - Security Report (sends alerts)
|
||||
|
||||
**Key Features:**
|
||||
- Frequent security monitoring every 10 minutes
|
||||
- Authentication log analysis
|
||||
- Fail2ban status monitoring
|
||||
- Certificate expiration tracking
|
||||
- AI-powered threat assessment
|
||||
- Immediate alerts for security incidents
|
||||
|
||||
### 6. Hanuman Helpdesk Agent (hanuman-helpdesk.json)
|
||||
|
||||
**Role:** Helpdesk Agent and Devoted Servant
|
||||
**Trigger:** Telegram (on message)
|
||||
**Version:** 1.0
|
||||
|
||||
**Nodes:**
|
||||
- Telegram Trigger - User Requests
|
||||
- Code - Parse User Request (categorization)
|
||||
- AI Agent - Hanuman Helpdesk (triage and response)
|
||||
- Code - Process Response
|
||||
- IF - Should Escalate?
|
||||
- Telegram - Direct Response
|
||||
- Telegram - Escalation Notice
|
||||
- Execute Workflow - Escalate to Vishnu
|
||||
|
||||
**Key Features:**
|
||||
- Real-time user support via Telegram
|
||||
- Intelligent request categorization
|
||||
- AI-powered triage and troubleshooting
|
||||
- Automatic escalation to specialist agents
|
||||
- Friendly, empathetic communication
|
||||
- User satisfaction tracking
|
||||
|
||||
### 7. Approval Handler (approval-handler.json)
|
||||
|
||||
**Role:** Utility Workflow for Human-in-the-Loop
|
||||
**Trigger:** Telegram (on message)
|
||||
@@ -142,7 +218,7 @@ Update these placeholder URLs to match your environment:
|
||||
5. Configure credentials and environment variables
|
||||
6. Activate the workflow
|
||||
|
||||
Repeat for all 4 workflows.
|
||||
Repeat for all 7 workflows.
|
||||
|
||||
### Method 2: Programmatic Import
|
||||
|
||||
@@ -150,7 +226,7 @@ Use the main export file with the n8n API or bulk import tool:
|
||||
|
||||
```bash
|
||||
# Example using the workflows-export.json structure
|
||||
# This file contains all 4 workflows in a single JSON with 'files' array
|
||||
# This file contains all 7 workflows in a single JSON with 'files' array
|
||||
cat workflows-export.json | jq -r '.files[] | @json' | while read workflow; do
|
||||
echo "$workflow" | n8n import:workflow --input=-
|
||||
done
|
||||
@@ -316,8 +392,11 @@ For issues or questions:
|
||||
|
||||
## Version History
|
||||
|
||||
- **v1.0** - Initial implementation with all 4 core workflows
|
||||
- Vishnu CTO Agent (Orchestrator)
|
||||
- Brahma Network Agent (Infrastructure)
|
||||
- Shiva DevOps Agent (Deployment)
|
||||
- **v1.0** - Initial implementation with all 6 AI agent workflows + 1 utility
|
||||
- Vishnu CTO Agent (Orchestrator - Preservation)
|
||||
- Brahma Network Agent (Infrastructure - Creation)
|
||||
- Shiva DevOps Agent (Deployment - Transformation)
|
||||
- Saraswati Database Agent (Data - Knowledge)
|
||||
- Ganesha Security Agent (Protection - Problem-Solving)
|
||||
- Hanuman Helpdesk Agent (Support - Service)
|
||||
- Approval Handler (Human-in-the-Loop)
|
||||
|
||||
@@ -300,13 +300,19 @@ n8n-AI-Multiple-Agent-Team/
|
||||
│ ├── vishnu-cto.json # 7 nodes, orchestration
|
||||
│ ├── brahma-network.json # 6 nodes, monitoring
|
||||
│ ├── shiva-devops.json # 9 nodes, deployment
|
||||
│ ├── saraswati-database.json # 6 nodes, database
|
||||
│ ├── ganesha-security.json # 7 nodes, security
|
||||
│ ├── hanuman-helpdesk.json # 8 nodes, support
|
||||
│ └── approval-handler.json # 7 nodes, approval
|
||||
│
|
||||
├── workflows/
|
||||
│ ├── agents/
|
||||
│ │ ├── vishnu-cto.json
|
||||
│ │ ├── brahma-network.json
|
||||
│ │ └── shiva-devops.json
|
||||
│ │ ├── shiva-devops.json
|
||||
│ │ ├── saraswati-database.json
|
||||
│ │ ├── ganesha-security.json
|
||||
│ │ └── hanuman-helpdesk.json
|
||||
│ └── utilities/
|
||||
│ └── approval-handler.json
|
||||
│
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
183
workflows/agents/ganesha-security.json
Normal file
183
workflows/agents/ganesha-security.json
Normal file
@@ -0,0 +1,183 @@
|
||||
{
|
||||
"name": "Ganesha Security Agent",
|
||||
"version": "1.0",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"field": "minutes",
|
||||
"minutesInterval": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "schedule-trigger-ganesha",
|
||||
"name": "Schedule Trigger - Every 10 min",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"command": "tail -n 100 /var/log/auth.log | grep -i 'failed\\|failure' || echo 'No recent failures'",
|
||||
"options": {}
|
||||
},
|
||||
"id": "execute-auth-logs",
|
||||
"name": "Execute Command - Auth Logs",
|
||||
"type": "n8n-nodes-base.executeCommand",
|
||||
"typeVersion": 1,
|
||||
"position": [450, 250]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"command": "fail2ban-client status sshd 2>/dev/null || echo 'Fail2ban not configured'",
|
||||
"options": {}
|
||||
},
|
||||
"id": "execute-fail2ban",
|
||||
"name": "Execute Command - Fail2ban Status",
|
||||
"type": "n8n-nodes-base.executeCommand",
|
||||
"typeVersion": 1,
|
||||
"position": [450, 350]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"command": "certbot certificates 2>/dev/null | grep -E 'Expiry|Domains' || echo 'No certificates found'",
|
||||
"options": {}
|
||||
},
|
||||
"id": "execute-cert-check",
|
||||
"name": "Execute Command - Certificate Check",
|
||||
"type": "n8n-nodes-base.executeCommand",
|
||||
"typeVersion": 1,
|
||||
"position": [450, 450]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Combine security monitoring data\nconst authLogs = $('Execute Command - Auth Logs').first()?.json?.stdout || 'No auth logs';\nconst fail2banStatus = $('Execute Command - Fail2ban Status').first()?.json?.stdout || 'Fail2ban unavailable';\nconst certStatus = $('Execute Command - Certificate Check').first()?.json?.stdout || 'No certificates';\n\nreturn {\n json: {\n timestamp: new Date().toISOString(),\n auth_logs: authLogs,\n fail2ban_status: fail2banStatus,\n certificate_status: certStatus,\n summary: `Security check at ${new Date().toLocaleString()}`\n }\n};"
|
||||
},
|
||||
"id": "code-combine-security-data",
|
||||
"name": "Code - Combine Security Data",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [650, 350]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"model": "gpt-4o-mini",
|
||||
"options": {
|
||||
"temperature": 0.7
|
||||
},
|
||||
"systemMessage": "You are Ganesha, the Security Engineer and Obstacle Remover.\n\nCOSMIC ATTRIBUTES:\n- Guardian: You protect the infrastructure from threats\n- Wisdom: You distinguish real threats from false alarms\n- Problem-Solving: You remove security obstacles (misconfigurations, lockouts)\n- Balance: You maintain security without impeding legitimate use\n\nDOMAIN EXPERTISE:\n- Firewall management (iptables, ufw, pfSense)\n- Access control (SSH keys, VPN, authentication)\n- SSL/TLS certificates (Let's Encrypt, renewal)\n- Security monitoring (logs, failed attempts)\n- Intrusion prevention (Fail2ban, Crowdsec)\n\nSECURITY MONITORING:\n- Failed SSH login attempts (>5 in 10 min = suspicious)\n- Firewall blocks and denies\n- Certificate expiration (alert 30 days before)\n- Unusual port scans or probing\n- Service authentication failures\n- VPN connections and disconnects\n\nTHREAT ASSESSMENT:\n1. Failed Logins:\n - <10/hour: Normal (typos, forgotten passwords)\n - >50/hour: Possible brute force attack\n - >200/hour: Active attack, block source\n\n2. Port Scans:\n - Sequential ports from single IP: Likely scan\n - Random ports, multiple IPs: Background internet noise\n\n3. Firewall Blocks:\n - Repeated blocks from known services: Misconfiguration\n - Blocks from unknown IPs: Normal defense\n\nSECURITY ACTIONS (with approval):\n- Block IP addresses (temporary or permanent)\n- Modify firewall rules\n- Renew certificates\n- Update Fail2ban filters\n- Adjust authentication settings\n\nSECURITY INCIDENTS:\nImmediate notification for:\n- Successful unauthorized access\n- Certificate expiration <7 days\n- Brute force attacks (>100 attempts/hour)\n- New ports exposed to internet\n- Firewall disabled or misconfigured\n\nOUTPUT FORMAT:\nRespond with JSON:\n{\n \"security_status\": \"secure/warning/critical\",\n \"failed_logins\": 0,\n \"certificates_expiring\": [],\n \"blocked_ips\": [],\n \"issues\": [],\n \"diagnosis\": \"your analysis\",\n \"proposed_action\": \"recommended fix\"\n}\n\nYOUR MANTRA: \"Vigilant but fair. Secure but accessible. Protected but not paranoid.\""
|
||||
},
|
||||
"id": "ai-agent-ganesha",
|
||||
"name": "AI Agent - Ganesha Security",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"typeVersion": 1,
|
||||
"position": [850, 350]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chatId": "={{$env.TELEGRAM_CHAT_ID}}",
|
||||
"text": "={{ '🛡️ Ganesha Security Report\\n\\n' + JSON.stringify($json, null, 2) }}",
|
||||
"additionalFields": {}
|
||||
},
|
||||
"id": "telegram-report",
|
||||
"name": "Telegram - Security Report",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1,
|
||||
"position": [1050, 350],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "1",
|
||||
"name": "Telegram API"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Schedule Trigger - Every 10 min": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Execute Command - Auth Logs",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Execute Command - Fail2ban Status",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Execute Command - Certificate Check",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Execute Command - Auth Logs": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code - Combine Security Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Execute Command - Fail2ban Status": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code - Combine Security Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Execute Command - Certificate Check": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code - Combine Security Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code - Combine Security Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent - Ganesha Security",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"AI Agent - Ganesha Security": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Telegram - Security Report",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {},
|
||||
"tags": [],
|
||||
"meta": {
|
||||
"description": "Workflow for the Ganesha Security Agent",
|
||||
"templateCredsSetupCompleted": true
|
||||
}
|
||||
}
|
||||
205
workflows/agents/hanuman-helpdesk.json
Normal file
205
workflows/agents/hanuman-helpdesk.json
Normal file
@@ -0,0 +1,205 @@
|
||||
{
|
||||
"name": "Hanuman Helpdesk Agent",
|
||||
"version": "1.0",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"updates": [
|
||||
"message"
|
||||
]
|
||||
},
|
||||
"id": "telegram-trigger-hanuman",
|
||||
"name": "Telegram Trigger - User Requests",
|
||||
"type": "n8n-nodes-base.telegramTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300],
|
||||
"webhookId": "hanuman-helpdesk",
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "1",
|
||||
"name": "Telegram API"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Parse user request from Telegram message\nconst message = $input.first().json.message;\nconst text = (message.text || '').trim();\nconst userId = message.from.id;\nconst chatId = message.chat.id;\nconst userName = message.from.first_name || 'User';\n\n// Simple categorization based on keywords\nlet category = 'general';\nlet urgency = 'low';\n\nconst textLower = text.toLowerCase();\n\nif (textLower.includes('down') || textLower.includes('not working') || textLower.includes('offline')) {\n category = 'service_down';\n urgency = 'high';\n} else if (textLower.includes('slow') || textLower.includes('performance')) {\n category = 'performance';\n urgency = 'medium';\n} else if (textLower.includes('network') || textLower.includes('wifi') || textLower.includes('connection')) {\n category = 'network';\n urgency = 'medium';\n} else if (textLower.includes('database') || textLower.includes('data')) {\n category = 'database';\n urgency = 'medium';\n} else if (textLower.includes('security') || textLower.includes('login') || textLower.includes('password')) {\n category = 'security';\n urgency = 'medium';\n} else if (textLower.includes('deploy') || textLower.includes('update')) {\n category = 'deployment';\n urgency = 'low';\n}\n\nreturn {\n json: {\n request: text,\n user_name: userName,\n user_id: userId,\n chat_id: chatId,\n category: category,\n urgency: urgency,\n timestamp: new Date().toISOString()\n }\n};"
|
||||
},
|
||||
"id": "code-parse-request",
|
||||
"name": "Code - Parse User Request",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [450, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"model": "gpt-4o-mini",
|
||||
"options": {
|
||||
"temperature": 0.7
|
||||
},
|
||||
"systemMessage": "You are Hanuman, the Helpdesk Agent and Devoted Servant.\n\nCOSMIC ATTRIBUTES:\n- Service: You serve users with dedication and enthusiasm\n- Strength: You handle high volumes of requests\n- Problem-Solving: You resolve common issues quickly\n- Loyalty: You ensure every request receives attention\n\nROLE:\nYou are the first point of contact for all user requests and issues.\nYour goal is to solve problems quickly or route to the right specialist.\n\nCAPABILITIES:\n- Answer common questions (service status, how-to guides)\n- Reset passwords and unlock accounts (with approval)\n- Provide service status and uptime information\n- Search knowledge base for solutions\n- Guide users through basic troubleshooting\n- Route complex issues to specialist agents\n\nTRIAGE PROCESS:\nWhen a request comes in:\n1. Categorize the issue:\n - Network: Slow internet, can't connect → Brahma (Network)\n - Service Down: App not working → Vishnu or Brahma (Compute)\n - Database: Data missing, slow queries → Saraswati\n - Security: Can't login, locked out → Ganesha\n - Deployment: Need update, feature request → Shiva\n - General: Status, info → Handle yourself\n\n2. Assess urgency:\n - CRITICAL: Service completely down, multiple users affected\n - HIGH: Single user blocked, urgent business need\n - MEDIUM: Degraded performance, workarounds available\n - LOW: Questions, feature requests, nice-to-have\n\n3. Take action:\n - Simple: Solve immediately (status checks, info)\n - Moderate: Use tools (check logs, restart container with approval)\n - Complex: Escalate to specialist or Vishnu\n\nCOMMUNICATION STYLE:\n- Friendly and approachable\n- Clear and concise\n- Empathetic to user frustration\n- Professional but warm\n- Set expectations (timeframes, limitations)\n\nESCALATION:\nAlways escalate when:\n- Outside your expertise\n- Requires privileged access\n- Affects multiple users\n- Security-sensitive\n- User is frustrated after 2 attempts\n\nOUTPUT FORMAT:\nRespond with JSON:\n{\n \"response_type\": \"direct_answer/escalation/troubleshooting\",\n \"message\": \"your friendly response to user\",\n \"escalate_to\": \"agent-name or null\",\n \"follow_up_needed\": true/false\n}\n\nYOUR MANTRA: \"Every user matters. Every issue resolved. Service with a smile.\""
|
||||
},
|
||||
"id": "ai-agent-hanuman",
|
||||
"name": "AI Agent - Hanuman Helpdesk",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"typeVersion": 1,
|
||||
"position": [650, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Parse Hanuman AI response\nconst aiResponse = $input.first().json;\nconst requestData = $('Code - Parse User Request').item.json;\n\nlet response = aiResponse;\nif (typeof aiResponse === 'string') {\n try {\n response = JSON.parse(aiResponse);\n } catch (e) {\n response = { \n message: aiResponse,\n response_type: 'direct_answer',\n escalate_to: null \n };\n }\n}\n\nreturn {\n json: {\n chat_id: requestData.chat_id,\n user_name: requestData.user_name,\n response_message: response.message || 'Processing your request...',\n should_escalate: response.escalate_to !== null && response.escalate_to !== undefined,\n escalate_to: response.escalate_to,\n response_type: response.response_type || 'direct_answer'\n }\n};"
|
||||
},
|
||||
"id": "code-process-response",
|
||||
"name": "Code - Process Response",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [850, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{ $json.should_escalate }}",
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "if-escalate",
|
||||
"name": "IF - Should Escalate?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2,
|
||||
"position": [1050, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chatId": "={{ $json.chat_id }}",
|
||||
"text": "👋 Hi {{ $json.user_name }}!\n\n{{ $json.response_message }}",
|
||||
"additionalFields": {}
|
||||
},
|
||||
"id": "telegram-direct-response",
|
||||
"name": "Telegram - Direct Response",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1,
|
||||
"position": [1250, 200],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "1",
|
||||
"name": "Telegram API"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chatId": "={{ $json.chat_id }}",
|
||||
"text": "👋 Hi {{ $json.user_name }}!\n\n{{ $json.response_message }}\n\n🔄 I'm escalating this to {{ $json.escalate_to }} for expert assistance. You'll receive an update soon!",
|
||||
"additionalFields": {}
|
||||
},
|
||||
"id": "telegram-escalation",
|
||||
"name": "Telegram - Escalation Notice",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1,
|
||||
"position": [1250, 400],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "1",
|
||||
"name": "Telegram API"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"workflowId": "vishnu-cto",
|
||||
"options": {}
|
||||
},
|
||||
"id": "execute-escalation",
|
||||
"name": "Execute Workflow - Escalate to Vishnu",
|
||||
"type": "n8n-nodes-base.executeWorkflow",
|
||||
"typeVersion": 1,
|
||||
"position": [1450, 400]
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Telegram Trigger - User Requests": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code - Parse User Request",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code - Parse User Request": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent - Hanuman Helpdesk",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"AI Agent - Hanuman Helpdesk": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code - Process Response",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code - Process Response": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF - Should Escalate?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF - Should Escalate?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Telegram - Escalation Notice",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Telegram - Direct Response",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Telegram - Escalation Notice": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Execute Workflow - Escalate to Vishnu",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {},
|
||||
"tags": [],
|
||||
"meta": {
|
||||
"description": "Workflow for the Hanuman Helpdesk Agent",
|
||||
"templateCredsSetupCompleted": true
|
||||
}
|
||||
}
|
||||
160
workflows/agents/saraswati-database.json
Normal file
160
workflows/agents/saraswati-database.json
Normal file
@@ -0,0 +1,160 @@
|
||||
{
|
||||
"name": "Saraswati Database Agent",
|
||||
"version": "1.0",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"field": "minutes",
|
||||
"minutesInterval": 30
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "schedule-trigger-saraswati",
|
||||
"name": "Schedule Trigger - Every 30 min",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "http://postgres.local:5432/health",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"options": {
|
||||
"allowUnauthorizedCerts": true
|
||||
}
|
||||
},
|
||||
"id": "http-db-status",
|
||||
"name": "HTTP Request - Database Status",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.2,
|
||||
"position": [450, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"command": "psql -h postgres.local -U admin -c \"SELECT COUNT(*) FROM pg_stat_activity;\" && psql -h postgres.local -U admin -c \"SELECT query, query_start FROM pg_stat_activity WHERE state = 'active' AND query_start < NOW() - INTERVAL '1 second';\"",
|
||||
"options": {}
|
||||
},
|
||||
"id": "execute-db-queries",
|
||||
"name": "Execute Command - Query Analysis",
|
||||
"type": "n8n-nodes-base.executeCommand",
|
||||
"typeVersion": 1,
|
||||
"position": [450, 450]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Combine database monitoring data\nconst dbStatus = $('HTTP Request - Database Status').first()?.json || { error: 'Database unavailable' };\nconst queryData = $('Execute Command - Query Analysis').first()?.json?.stdout || 'Query analysis failed';\n\nreturn {\n json: {\n timestamp: new Date().toISOString(),\n database_status: dbStatus,\n query_analysis: queryData,\n summary: `Database check at ${new Date().toLocaleString()}`\n }\n};"
|
||||
},
|
||||
"id": "code-combine-db-data",
|
||||
"name": "Code - Combine Database Data",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [650, 375]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"model": "gpt-4o-mini",
|
||||
"options": {
|
||||
"temperature": 0.7
|
||||
},
|
||||
"systemMessage": "You are Saraswati, the Database Administrator and Knowledge Keeper.\n\nCOSMIC ATTRIBUTES:\n- Knowledge: You guard and organize all structured data\n- Wisdom: You optimize how information flows\n- Learning: You improve performance based on patterns\n- Purity: You maintain data integrity and consistency\n\nDOMAIN EXPERTISE:\n- Relational databases (PostgreSQL, MySQL, MariaDB)\n- NoSQL databases (MongoDB, Redis)\n- Query optimization and indexing\n- Backup and recovery procedures\n- Schema design and migrations\n\nMONITORING DUTIES:\n- Database server status (running, accepting connections)\n- Query performance (slow queries >1s)\n- Connection pool usage (max connections warning)\n- Replication lag (if applicable)\n- Backup job success/failure\n- Disk space for database files\n- Lock contention and deadlocks\n\nPERFORMANCE ANALYSIS:\n1. Identify slow queries (execution time >1s)\n2. Check for missing indexes\n3. Analyze query plans (EXPLAIN)\n4. Monitor cache hit ratio (should be >90%)\n5. Detect N+1 query problems\n6. Recommend optimizations\n\nDATA INTEGRITY:\n- Verify backup completion\n- Test restore procedures monthly\n- Check foreign key constraints\n- Validate data consistency\n- Monitor for corruption\n\nCAUTIOUS APPROACH:\nDatabases require careful handling:\n- READ-ONLY queries for diagnostics\n- NEVER DELETE or UPDATE without approval\n- Backup before any schema changes\n- Test migrations in staging first\n- Escalate to Vishnu and human for schema changes, data modifications, replication failover, recovery operations\n\nOUTPUT FORMAT:\nRespond with JSON:\n{\n \"database_health\": \"healthy/degraded/critical\",\n \"connection_count\": 0,\n \"slow_queries\": [],\n \"issues\": [],\n \"diagnosis\": \"your analysis\",\n \"proposed_action\": \"recommended fix\"\n}\n\nYOUR MANTRA: \"Data is truth. Queries are questions. Backups are insurance.\""
|
||||
},
|
||||
"id": "ai-agent-saraswati",
|
||||
"name": "AI Agent - Saraswati Database",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"typeVersion": 1,
|
||||
"position": [850, 375]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chatId": "={{$env.TELEGRAM_CHAT_ID}}",
|
||||
"text": "={{ '📚 Saraswati Database Report\\n\\n' + JSON.stringify($json, null, 2) }}",
|
||||
"additionalFields": {}
|
||||
},
|
||||
"id": "telegram-report",
|
||||
"name": "Telegram - Database Report",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1,
|
||||
"position": [1050, 375],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "1",
|
||||
"name": "Telegram API"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Schedule Trigger - Every 30 min": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "HTTP Request - Database Status",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Execute Command - Query Analysis",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"HTTP Request - Database Status": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code - Combine Database Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Execute Command - Query Analysis": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code - Combine Database Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code - Combine Database Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent - Saraswati Database",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"AI Agent - Saraswati Database": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Telegram - Database Report",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {},
|
||||
"tags": [],
|
||||
"meta": {
|
||||
"description": "Workflow for the Saraswati Database Agent",
|
||||
"templateCredsSetupCompleted": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user