diff --git a/ceo-ai-enterprise-workflow-v3.json b/ceo-ai-enterprise-workflow-v3.json new file mode 100644 index 0000000..709f174 --- /dev/null +++ b/ceo-ai-enterprise-workflow-v3.json @@ -0,0 +1,421 @@ +{ + "name": "CEO AI Enterprise Workflow v3", + "nodes": [ + { + "parameters": { + "httpMethod": "POST", + "path": "enterprise-request", + "responseMode": "responseNode", + "options": {} + }, + "id": "node-entry-01", + "name": "Webhook Input", + "type": "n8n-nodes-base.webhook", + "typeVersion": 1, + "position": [80, 500] + }, + { + "parameters": { + "jsCode": "const input = $input.first().json;\nconst userProblem = input.problem || input.body?.problem || '';\nconst userEmail = input.email || input.body?.email || 'mail.mail@gmail.com';\nconst sendMail = input.send_mail || input.body?.send_mail || false;\nconst mailCategory = input.mail_category || input.body?.mail_category || 'Autres';\nconst transcription = input.transcription || input.body?.transcription || '';\n\nconst text = userProblem.toLowerCase();\nconst devRequested = ['développement','prototype','code','pipeline','architecture logicielle','software'].some(k => text.includes(k));\nconst writingRequested = ['compte rendu','compte-rendu','réunion','meeting','rédaction','rapport','transcription'].some(k => text.includes(k)) || transcription.length > 0;\nconst deepLearningFocus = ['deep learning','deeplearning','neural network','transformer','llm'].some(k => text.includes(k));\nconst symbolicFocus = ['symbolique','logic','ontologie','knowledge graph','règle'].some(k => text.includes(k));\n\nreturn [{\n json: {\n user_problem: userProblem,\n user_email: userEmail,\n send_mail_requested: sendMail,\n mail_category: mailCategory,\n transcription,\n ceo_instructions: {\n reformulated_objective: 'Objectif de recherche : ' + userProblem,\n dev_requested: devRequested,\n writing_requested: writingRequested,\n deep_learning_focus: deepLearningFocus,\n symbolic_focus: symbolicFocus,\n mission_plan: [\n '1. Recherche DBLP multi-agent',\n '2. Sous-cellule Neuro-Symbolique (Symbolique + Deep Learning)',\n '3. Consolidation + présentation article + trame PPT',\n devRequested ? '4. Activation équipe Développement + Testing multi-agent' : '4. Développement non activé',\n writingRequested ? '5. Activation équipe Communication' : '5. Communication non activée'\n ],\n categories: ['Green IT','IA neuro_symbolique','architecture solution','scoring'],\n source_constraint: 'DBLP uniquement — https://dblp.org'\n },\n timestamp: new Date().toISOString()\n }\n}];" + }, + "id": "node-ceo-01", + "name": "CEO Agent", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [340, 500] + }, + { + "parameters": { + "jsCode": "const ceo = $input.first().json;\nconst p = ceo.user_problem;\nreturn [\n { json: { ...ceo, research_task: { agent_name: 'Research Agent 1 - Green IT', target_category: 'Green IT', dblp_query: p + ' green computing sustainability energy efficiency' } } },\n { json: { ...ceo, research_task: { agent_name: 'Research Agent 2A - Symbolique', target_category: 'IA neuro_symbolique', dblp_query: p + ' symbolic AI logic ontology knowledge graph reasoning' } } },\n { json: { ...ceo, research_task: { agent_name: 'Research Agent 2B - Deep Learning', target_category: 'IA neuro_symbolique', dblp_query: p + ' deep learning neural network transformer representation learning' } } },\n { json: { ...ceo, research_task: { agent_name: 'Research Agent 3 - Architecture', target_category: 'architecture solution', dblp_query: p + ' solution architecture distributed systems cloud microservices' } } },\n { json: { ...ceo, research_task: { agent_name: 'Research Agent 4 - Scoring', target_category: 'scoring', dblp_query: p + ' scoring evaluation metrics benchmark assessment' } } }\n];" + }, + "id": "node-r-01", + "name": "Research Manager", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [620, 500] + }, + { + "parameters": { + "url": "https://dblp.org/search/publ/api", + "sendQuery": true, + "queryParameters": { + "parameters": [ + { "name": "q", "value": "={{ $json.research_task.dblp_query }}" }, + { "name": "format", "value": "json" }, + { "name": "h", "value": "10" } + ] + }, + "options": {} + }, + "id": "node-r-02", + "name": "Research Agent 1 - Green IT", + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4, + "position": [900, 120] + }, + { + "parameters": { + "url": "https://dblp.org/search/publ/api", + "sendQuery": true, + "queryParameters": { + "parameters": [ + { "name": "q", "value": "={{ $json.research_task.dblp_query }}" }, + { "name": "format", "value": "json" }, + { "name": "h", "value": "10" } + ] + }, + "options": {} + }, + "id": "node-r-03a", + "name": "Research Agent 2A - Symbolique", + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4, + "position": [900, 260] + }, + { + "parameters": { + "url": "https://dblp.org/search/publ/api", + "sendQuery": true, + "queryParameters": { + "parameters": [ + { "name": "q", "value": "={{ $json.research_task.dblp_query }}" }, + { "name": "format", "value": "json" }, + { "name": "h", "value": "10" } + ] + }, + "options": {} + }, + "id": "node-r-03b", + "name": "Research Agent 2B - Deep Learning", + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4, + "position": [900, 400] + }, + { + "parameters": { + "url": "https://dblp.org/search/publ/api", + "sendQuery": true, + "queryParameters": { + "parameters": [ + { "name": "q", "value": "={{ $json.research_task.dblp_query }}" }, + { "name": "format", "value": "json" }, + { "name": "h", "value": "10" } + ] + }, + "options": {} + }, + "id": "node-r-04", + "name": "Research Agent 3 - Architecture", + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4, + "position": [900, 540] + }, + { + "parameters": { + "url": "https://dblp.org/search/publ/api", + "sendQuery": true, + "queryParameters": { + "parameters": [ + { "name": "q", "value": "={{ $json.research_task.dblp_query }}" }, + { "name": "format", "value": "json" }, + { "name": "h", "value": "10" } + ] + }, + "options": {} + }, + "id": "node-r-05", + "name": "Research Agent 4 - Scoring", + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4, + "position": [900, 680] + }, + { + "parameters": { "mode": "append", "options": {} }, + "id": "node-r-06", + "name": "Merge Research Results", + "type": "n8n-nodes-base.merge", + "typeVersion": 2, + "position": [1160, 420] + }, + { + "parameters": { + "jsCode": "const items = $input.all();\nconst seen = new Set();\nconst out = [];\nfor (const item of items) {\n const raw = item.json;\n const task = raw.research_task || {};\n const hits = raw?.result?.hits?.hit || [];\n for (const h of hits) {\n const i = h.info || {};\n const key = (i.title + (i.doi||'') + (i.key||'')).toLowerCase().replace(/\\s+/g,'');\n if (!i.title || seen.has(key)) continue;\n seen.add(key);\n out.push({\n title: i.title,\n year: i.year || '',\n authors: Array.isArray(i.authors?.author) ? i.authors.author.map(a => typeof a === 'string' ? a : (a.text || a['#text'] || '')) : [],\n venue: i.venue || i.journal || '',\n doi: i.doi || '',\n dblp_key: i.key || '',\n dblp_url: i.url || i.ee || '',\n source: 'DBLP',\n agent_name: task.agent_name,\n category: task.target_category\n });\n }\n}\nreturn [{ json: { research_results: out, total_raw: out.length } }];" + }, + "id": "node-r-07", + "name": "Consolidate Research Results", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [1380, 420] + }, + { + "parameters": { + "jsCode": "const data = $input.first().json;\nconst articles = data.research_results || [];\nconst presentation_articles = articles.map(a => ({\n ...a,\n summary: `Article: ${a.title}. Publication: ${a.venue} (${a.year || 'N/A'}).`,\n slide_ideas: [\n `Titre: ${a.title}`,\n `Contexte problématique: relié à la demande utilisateur`,\n `Apport principal: à discuter`,\n `Source DBLP: ${a.dblp_url || 'N/A'}`\n ]\n}));\nconst ppt_outline = {\n title: 'Synthèse Recherche CEO',\n slides: [\n { section: 'Contexte & Objectif', ideas: ['Problématique client', 'Objectif reformulé'] },\n { section: 'Top articles par catégorie', ideas: ['Green IT', 'IA Neuro-Symbolique', 'Architecture', 'Scoring'] },\n { section: 'Recommandations', ideas: ['Actions court terme', 'Axes développement'] }\n ]\n};\nreturn [{ json: { presentation_articles, ppt_outline, total: presentation_articles.length } }];" + }, + "id": "node-r-08", + "name": "Article Presentation Agent", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [1600, 420] + }, + { + "parameters": { + "conditions": { "boolean": [ { "value1": "={{ $json.ceo_instructions.dev_requested }}", "value2": true } ] } + }, + "id": "node-d-01", + "name": "IF Dev Requested?", + "type": "n8n-nodes-base.if", + "typeVersion": 1, + "position": [620, 840] + }, + { + "parameters": { + "jsCode": "const ceo = $input.first().json;\nreturn [{ json: {\n user_problem: ceo.user_problem,\n dev_backlog: [\n 'Collecte DBLP et normalisation',\n 'Classification neuro-symbolique',\n 'Scoring et API de restitution'\n ]\n} }];" + }, + "id": "node-d-02", + "name": "Development Team Lead", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [860, 840] + }, + { + "parameters": { + "jsCode": "const d = $input.first().json; return [{ json: { ai_specs: { owner: 'Dev Agent IA', tasks: ['modèle deep learning', 'module neuro-symbolique'] }, ctx: d } }];" + }, + "id": "node-d-03a", + "name": "Dev Agent IA", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [1120, 760] + }, + { + "parameters": { + "jsCode": "const d = $input.first().json; return [{ json: { ds_specs: { owner: 'Dev Agent Data Scientist', tasks: ['features', 'scoring', 'benchmark'] }, ctx: d } }];" + }, + "id": "node-d-03b", + "name": "Dev Agent Data Scientist", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [1120, 920] + }, + { + "parameters": { "mode": "append", "options": {} }, + "id": "node-d-03m", + "name": "Merge Dev Agents", + "type": "n8n-nodes-base.merge", + "typeVersion": 2, + "position": [1360, 840] + }, + { + "parameters": { + "jsCode": "const items = $input.all().map(i => i.json);\nreturn [{ json: { dev_outputs: items, handoff: 'to testing lead' } }];" + }, + "id": "node-d-04", + "name": "Testing Team Lead", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [1560, 840] + }, + { + "parameters": { "jsCode": "return [{ json: { test_area: 'Papers & expériences', result: 'OK' } }];" }, + "id": "node-d-05a", + "name": "Testing Agent - Papers", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [1780, 680] + }, + { + "parameters": { "jsCode": "return [{ json: { test_area: 'Deep Learning', result: 'OK' } }];" }, + "id": "node-d-05b", + "name": "Testing Agent - Deep Learning", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [1780, 800] + }, + { + "parameters": { "jsCode": "return [{ json: { test_area: 'Symbolique', result: 'OK' } }];" }, + "id": "node-d-05c", + "name": "Testing Agent - Symbolique", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [1780, 920] + }, + { + "parameters": { "jsCode": "return [{ json: { test_area: 'Neuro-Symbolique', result: 'OK' } }];" }, + "id": "node-d-05d", + "name": "Testing Agent - Neuro-Symbolique", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [1780, 1040] + }, + { + "parameters": { "mode": "append", "options": {} }, + "id": "node-d-06", + "name": "Merge Testing Results", + "type": "n8n-nodes-base.merge", + "typeVersion": 2, + "position": [2020, 840] + }, + { + "parameters": { + "conditions": { "boolean": [ { "value1": "={{ $json.ceo_instructions.writing_requested }}", "value2": true } ] } + }, + "id": "node-w-01", + "name": "IF Writing Requested?", + "type": "n8n-nodes-base.if", + "typeVersion": 1, + "position": [620, 1180] + }, + { + "parameters": { "jsCode": "const ceo = $input.first().json; return [{ json: { transcription: ceo.transcription || '', problem: ceo.user_problem || '' } }];" }, + "id": "node-w-02", + "name": "Communication Team Lead", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [860, 1180] + }, + { + "parameters": { "jsCode": "const d=$input.first().json; return [{ json: { meeting_minutes: 'Compte rendu réunion généré', src: d.transcription } }];" }, + "id": "node-w-03", + "name": "Meeting Minutes Agent", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [1120, 1120] + }, + { + "parameters": { "jsCode": "const d=$input.first().json; return [{ json: { general_writing: 'Rédaction hors recherche prête', topic: d.problem } }];" }, + "id": "node-w-04", + "name": "General Writing Agent", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [1120, 1240] + }, + { + "parameters": { "mode": "append", "options": {} }, + "id": "node-w-05", + "name": "Merge Communication Outputs", + "type": "n8n-nodes-base.merge", + "typeVersion": 2, + "position": [1360, 1180] + }, + { + "parameters": { + "jsCode": "const data = $('Article Presentation Agent').first().json;\nconst ceo = $('CEO Agent').first().json;\nlet dev = null; try { dev = $('Merge Testing Results').all().map(i => i.json); } catch(e) {}\nlet comm = null; try { comm = $('Merge Communication Outputs').all().map(i => i.json); } catch(e) {}\nconst articles = data.presentation_articles || [];\nconst html = `
${ceo.user_problem}
Total: ${articles.length}
`;\nreturn [{ json: {\n to: ceo.user_email || 'mail.mail@gmail.com',\n subject: '[Recherche DBLP] Synthèse CEO',\n email_html: html,\n ppt_outline: data.ppt_outline,\n dev_result: dev,\n communication_result: comm,\n send_mail_requested: ceo.send_mail_requested\n} }];" + }, + "id": "node-m-01", + "name": "Assistant - Results Consolidation", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [2280, 620] + }, + { + "parameters": { + "conditions": { "boolean": [ { "value1": "={{ $json.send_mail_requested }}", "value2": true } ] } + }, + "id": "node-m-02", + "name": "IF Send Mail?", + "type": "n8n-nodes-base.if", + "typeVersion": 1, + "position": [2520, 620] + }, + { + "parameters": { + "fromEmail": "assistante@enterprise.ai", + "toEmail": "={{ $json.to }}", + "subject": "={{ $json.subject }}", + "emailType": "html", + "message": "={{ $json.email_html }}", + "options": {} + }, + "id": "node-m-03", + "name": "Send Email - Unified", + "type": "n8n-nodes-base.emailSend", + "typeVersion": 2, + "position": [2760, 560] + }, + { + "parameters": { + "jsCode": "const data = $input.first().json;\nconst ceo = $('CEO Agent').first().json;\nreturn [{ json: {\n timestamp: new Date().toISOString(),\n status: 'COMPLETED',\n user_problem: ceo.user_problem,\n email_target: ceo.user_email || 'mail.mail@gmail.com',\n mission_plan: ceo.ceo_instructions.mission_plan,\n ppt_outline: data.ppt_outline,\n dev_result: data.dev_result,\n communication_result: data.communication_result\n} }];" + }, + "id": "node-final-01", + "name": "Final CEO Synthesis", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [3000, 680] + }, + { + "parameters": { + "respondWith": "json", + "responseBody": "={{ JSON.stringify($json, null, 2) }}", + "options": {} + }, + "id": "node-final-02", + "name": "Webhook Response", + "type": "n8n-nodes-base.respondToWebhook", + "typeVersion": 1, + "position": [3240, 680] + } + ], + "connections": { + "Webhook Input": { "main": [[{ "node": "CEO Agent", "type": "main", "index": 0 }]] }, + "CEO Agent": { "main": [[ + { "node": "Research Manager", "type": "main", "index": 0 }, + { "node": "IF Dev Requested?", "type": "main", "index": 0 }, + { "node": "IF Writing Requested?", "type": "main", "index": 0 } + ]] }, + "Research Manager": { "main": [[ + { "node": "Research Agent 1 - Green IT", "type": "main", "index": 0 }, + { "node": "Research Agent 2A - Symbolique", "type": "main", "index": 0 }, + { "node": "Research Agent 2B - Deep Learning", "type": "main", "index": 0 }, + { "node": "Research Agent 3 - Architecture", "type": "main", "index": 0 }, + { "node": "Research Agent 4 - Scoring", "type": "main", "index": 0 } + ]] }, + "Research Agent 1 - Green IT": { "main": [[{ "node": "Merge Research Results", "type": "main", "index": 0 }]] }, + "Research Agent 2A - Symbolique": { "main": [[{ "node": "Merge Research Results", "type": "main", "index": 1 }]] }, + "Research Agent 2B - Deep Learning": { "main": [[{ "node": "Merge Research Results", "type": "main", "index": 2 }]] }, + "Research Agent 3 - Architecture": { "main": [[{ "node": "Merge Research Results", "type": "main", "index": 3 }]] }, + "Research Agent 4 - Scoring": { "main": [[{ "node": "Merge Research Results", "type": "main", "index": 4 }]] }, + "Merge Research Results": { "main": [[{ "node": "Consolidate Research Results", "type": "main", "index": 0 }]] }, + "Consolidate Research Results": { "main": [[{ "node": "Article Presentation Agent", "type": "main", "index": 0 }]] }, + + "IF Dev Requested?": { "main": [[{ "node": "Development Team Lead", "type": "main", "index": 0 }], []] }, + "Development Team Lead": { "main": [[ + { "node": "Dev Agent IA", "type": "main", "index": 0 }, + { "node": "Dev Agent Data Scientist", "type": "main", "index": 0 } + ]] }, + "Dev Agent IA": { "main": [[{ "node": "Merge Dev Agents", "type": "main", "index": 0 }]] }, + "Dev Agent Data Scientist": { "main": [[{ "node": "Merge Dev Agents", "type": "main", "index": 1 }]] }, + "Merge Dev Agents": { "main": [[{ "node": "Testing Team Lead", "type": "main", "index": 0 }]] }, + "Testing Team Lead": { "main": [[ + { "node": "Testing Agent - Papers", "type": "main", "index": 0 }, + { "node": "Testing Agent - Deep Learning", "type": "main", "index": 0 }, + { "node": "Testing Agent - Symbolique", "type": "main", "index": 0 }, + { "node": "Testing Agent - Neuro-Symbolique", "type": "main", "index": 0 } + ]] }, + "Testing Agent - Papers": { "main": [[{ "node": "Merge Testing Results", "type": "main", "index": 0 }]] }, + "Testing Agent - Deep Learning": { "main": [[{ "node": "Merge Testing Results", "type": "main", "index": 1 }]] }, + "Testing Agent - Symbolique": { "main": [[{ "node": "Merge Testing Results", "type": "main", "index": 2 }]] }, + "Testing Agent - Neuro-Symbolique": { "main": [[{ "node": "Merge Testing Results", "type": "main", "index": 3 }]] }, + + "IF Writing Requested?": { "main": [[{ "node": "Communication Team Lead", "type": "main", "index": 0 }], []] }, + "Communication Team Lead": { "main": [[ + { "node": "Meeting Minutes Agent", "type": "main", "index": 0 }, + { "node": "General Writing Agent", "type": "main", "index": 0 } + ]] }, + "Meeting Minutes Agent": { "main": [[{ "node": "Merge Communication Outputs", "type": "main", "index": 0 }]] }, + "General Writing Agent": { "main": [[{ "node": "Merge Communication Outputs", "type": "main", "index": 1 }]] }, + + "Article Presentation Agent": { "main": [[{ "node": "Assistant - Results Consolidation", "type": "main", "index": 0 }]] }, + "Assistant - Results Consolidation": { "main": [[ + { "node": "IF Send Mail?", "type": "main", "index": 0 }, + { "node": "Final CEO Synthesis", "type": "main", "index": 0 } + ]] }, + "IF Send Mail?": { "main": [[{ "node": "Send Email - Unified", "type": "main", "index": 0 }], []] }, + "Final CEO Synthesis": { "main": [[{ "node": "Webhook Response", "type": "main", "index": 0 }]] } + }, + "active": false, + "settings": { "executionOrder": "v1" }, + "versionId": "3.0.0", + "meta": { "templateCredsSetupCompleted": true }, + "id": "ceo-ai-enterprise-workflow-v3", + "tags": ["enterprise","ceo-ai","research","dblp","development","writing","multi-agent","mail-routing"] +}