AutomationFlowsAI & RAG › Sistema Multiagente - Orquestador

Sistema Multiagente - Orquestador

Sistema Multiagente - Orquestador. Uses openAi, httpRequest. Webhook trigger; 7 nodes.

Webhook trigger★★★★☆ complexityAI-powered7 nodesOpenAIHTTP Request
AI & RAG Trigger: Webhook Nodes: 7 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the HTTP Request → OpenAI recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Sistema Multiagente - Orquestador",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "orchestrator",
        "options": {}
      },
      "id": "23a1a4e5-3ff9-4d8f-8e6b-1a2b3c4d5e6f",
      "name": "Webhook Orquestador",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "model": "gpt-4o",
        "options": {
          "systemMessage": "Eres el AGENTE ORQUESTADOR de un sistema multiagente. Tu funci\u00f3n principal es:\n\nRESPONSABILIDADES:\n1. Recibir y analizar requests del usuario\n2. Determinar qu\u00e9 agentes hijos necesitas activar\n3. Distribuir tareas espec\u00edficas a cada agente hijo\n4. Validar la calidad y coherencia de las respuestas recibidas\n5. Sintetizar informaci\u00f3n de m\u00faltiples fuentes\n6. Generar respuesta final coherente y completa\n\nAGENTES DISPONIBLES:\n- Agente Supabase: Para consultas de base de datos\n- Agente Web Scraping: Para informaci\u00f3n de internet\n\nPROCESO DE VALIDACI\u00d3N:\n- Verificar completitud de datos\n- Detectar inconsistencias entre fuentes\n- Evaluar relevancia de la informaci\u00f3n\n- Asegurar calidad de respuesta final\n\nFORMATO DE COMUNICACI\u00d3N:\n- Con agentes hijos: JSON estructurado con task_id, action, parameters\n- Con usuario: Respuesta natural y comprensible\n\nCRITERIOS DE CALIDAD:\n- Precisi\u00f3n de datos\n- Coherencia entre fuentes\n- Completitud de respuesta\n- Relevancia al request original"
        },
        "prompt": "Analiza esta solicitud y determina qu\u00e9 agentes necesitas activar. Solicitud del usuario: {{ $json.query }}\n\nResponde con un JSON que incluya:\n1. agents_needed: array de agentes necesarios (supabase, scraping, o ambos)\n2. tasks: array de tareas espec\u00edficas para cada agente\n3. context: contexto para la validaci\u00f3n final"
      },
      "id": "34b2b5f6-4ff9-4d8f-8e6b-2a3b4c5d6e7f",
      "name": "An\u00e1lisis de Solicitud",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "const analysis = JSON.parse($json.choices[0].message.content);\nconst tasks = [];\n\nfor (const agent of analysis.agents_needed) {\n  const task = {\n    message_id: `task_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,\n    from_agent: 'orchestrator',\n    to_agent: agent,\n    task_type: agent === 'supabase' ? 'query' : 'scrape',\n    payload: {\n      action: analysis.tasks.find(t => t.agent === agent)?.action || 'default',\n      parameters: analysis.tasks.find(t => t.agent === agent)?.parameters || {},\n      context: analysis.context\n    },\n    timestamp: new Date().toISOString(),\n    priority: 'high'\n  };\n  tasks.push(task);\n}\n\nreturn tasks.map(task => ({ json: task }));"
      },
      "id": "45c3c6f7-5ff9-4d8f-8e6b-3a4b5c6d7e8f",
      "name": "Preparar Tareas",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {
        "url": "={{ $json.to_agent === 'supabase' ? 'http://localhost:5678/webhook/supabase-agent' : 'http://localhost:5678/webhook/scraping-agent' }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "task",
              "value": "={{ JSON.stringify($json) }}"
            }
          ]
        }
      },
      "id": "56d4d7f8-6ff9-4d8f-8e6b-4a5b6c7d8e9f",
      "name": "Enviar a Agentes",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        900,
        300
      ]
    },
    {
      "parameters": {
        "amount": 30,
        "unit": "seconds"
      },
      "id": "67e5e8f9-7ff9-4d8f-8e6b-5a6b7c8d9eaf",
      "name": "Esperar Respuestas",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        1120,
        300
      ]
    },
    {
      "parameters": {
        "model": "gpt-4o",
        "options": {
          "systemMessage": "Eres el validador final del sistema multiagente. Debes:\n1. Analizar las respuestas de los agentes hijos\n2. Detectar inconsistencias o errores\n3. Sintetizar la informaci\u00f3n en una respuesta coherente\n4. Asegurar que la respuesta sea completa y \u00fatil"
        },
        "prompt": "Bas\u00e1ndote en las siguientes respuestas de los agentes, genera una respuesta final sintetizada:\n\nRespuestas recibidas: {{ JSON.stringify($json) }}\n\nGenera una respuesta final que sea:\n- Completa y coherente\n- Basada en evidencia de las fuentes\n- \u00datil para el usuario\n- Bien estructurada"
      },
      "id": "78f6f9fa-8ff9-4d8f-8e6b-6a7b8c9daeaf",
      "name": "Validaci\u00f3n y S\u00edntesis",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        1340,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ status: 'success', response: $json.choices[0].message.content, timestamp: new Date().toISOString() }) }}"
      },
      "id": "89g7gafb-9ff9-4d8f-8e6b-7a8b9cadebaf",
      "name": "Respuesta Final",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1560,
        300
      ]
    }
  ],
  "connections": {
    "Webhook Orquestador": {
      "main": [
        [
          {
            "node": "An\u00e1lisis de Solicitud",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "An\u00e1lisis de Solicitud": {
      "main": [
        [
          {
            "node": "Preparar Tareas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Preparar Tareas": {
      "main": [
        [
          {
            "node": "Enviar a Agentes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enviar a Agentes": {
      "main": [
        [
          {
            "node": "Esperar Respuestas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Esperar Respuestas": {
      "main": [
        [
          {
            "node": "Validaci\u00f3n y S\u00edntesis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validaci\u00f3n y S\u00edntesis": {
      "main": [
        [
          {
            "node": "Respuesta Final",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "versionId": "1"
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Sistema Multiagente - Orquestador. Uses openAi, httpRequest. Webhook trigger; 7 nodes.

Source: https://gist.github.com/laelsunchocannon-oss/bcc57d14a14252ac75150c7bc1c49d3b — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

VEP WAPP. Uses openAi, lmChatOpenAi, toolCalculator, agent. Webhook trigger; 100 nodes.

OpenAI, OpenAI Chat, Tool Calculator +7
AI & RAG

Cold email Agent. Uses googleSheets, gmail, httpRequest, openAi. Webhook trigger; 100 nodes.

Google Sheets, Gmail, HTTP Request +1
AI & RAG

Cold email Agent. Uses googleSheets, gmail, httpRequest, openAi. Webhook trigger; 100 nodes.

Google Sheets, Gmail, HTTP Request +1
AI & RAG

CLINICAINTEGRAL_secretary. Uses postgres, mcpClientTool, googleDriveTool, toolWorkflow. Webhook trigger; 89 nodes.

Postgres, Mcp Client Tool, Google Drive Tool +14
AI & RAG

Remi 1.1. Uses lmChatOpenAi, memoryPostgresChat, openAi, postgres. Webhook trigger; 89 nodes.

OpenAI Chat, Memory Postgres Chat, OpenAI +7