AutomationFlowsAI & RAG › Analyze Global Supply Chain Sustainability and Risk with Gpt-4o and Email Alerts

Analyze Global Supply Chain Sustainability and Risk with Gpt-4o and Email Alerts

ByCheng Siong Chin @cschin on n8n.io

This workflow automates supply chain monitoring and risk management by deploying multiple specialized AI agents to analyze different supply chain dimensions simultaneously. Designed for supply chain managers, procurement teams, and logistics coordinators, it solves the critical…

Cron / scheduled trigger★★★★★ complexityAI-powered31 nodesHTTP RequestAgentOpenAI ChatOutput Parser StructuredEmail SendTool CodeHTTP Request Tool
AI & RAG Trigger: Cron / scheduled Nodes: 31 Complexity: ★★★★★ AI nodes: yes Added:

This workflow corresponds to n8n.io template #12988 — we link there as the canonical source.

This workflow follows the Agent → Emailsend 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
{
  "id": "0K0nGcigod3trFGC",
  "name": "Smart Global Supply Chain Sustainability Analyzer and Optimizer",
  "tags": [],
  "nodes": [
    {
      "id": "864c3be9-8586-40f0-98d2-6dff34a2f76d",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -800,
        504
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 6
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "9e40008d-ace8-4f49-bca0-7493a31e51ae",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -576,
        504
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "supplyChainApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Supply Chain API endpoint URL__>"
            },
            {
              "id": "id-2",
              "name": "storageApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Storage/Database API endpoint URL__>"
            },
            {
              "id": "id-3",
              "name": "alertEmailRecipients",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Comma-separated email addresses for alerts__>"
            },
            {
              "id": "id-4",
              "name": "criticalThreshold",
              "type": "number",
              "value": 90
            },
            {
              "id": "id-5",
              "name": "highThreshold",
              "type": "number",
              "value": 70
            },
            {
              "id": "id-6",
              "name": "mediumThreshold",
              "type": "number",
              "value": 40
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "4687f64e-73b1-48af-9971-3b311ce427c2",
      "name": "Fetch Supply Chain Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -352,
        504
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.supplyChainApiUrl }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "f2221294-fc92-48cc-9207-f12ec6ee9720",
      "name": "Supply Chain Sustainability Analyzer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        688,
        224
      ],
      "parameters": {
        "text": "={{ $json }}",
        "options": {
          "systemMessage": "You are a green economics AI agent specialized in analyzing global supply chains for environmental sustainability.\n\nYour task is to:\n1. Evaluate supplier emissions data (CO2e, methane, other greenhouse gases)\n2. Analyze energy consumption patterns and renewable energy usage\n3. Assess material sourcing practices (recycled content, sustainable materials, origin)\n4. Evaluate logistics efficiency (transportation modes, route optimization, carbon footprint)\n5. Score circular economy practices (waste reduction, recycling, product lifecycle)\n6. Identify environmental bottlenecks and high-impact risks\n7. Calculate priority scores based on environmental impact severity\n8. Recommend specific optimization strategies\n\nAnalysis criteria:\n- Emissions: Calculate total CO2e and compare against industry benchmarks\n- Energy: Assess renewable vs non-renewable ratio and efficiency metrics\n- Materials: Evaluate sustainability certifications and sourcing transparency\n- Logistics: Analyze transportation carbon intensity and route efficiency\n- Circular Economy: Score based on waste diversion, material recovery, and product longevity\n\nRisk levels:\n- CRITICAL (90-100): Immediate environmental threat requiring urgent action\n- HIGH (70-89): Significant impact needing priority intervention\n- MEDIUM (40-69): Moderate concern requiring planned improvements\n- LOW (0-39): Acceptable performance with optimization opportunities\n\nProvide deterministic, data-driven analysis with specific metrics and actionable recommendations."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "06b29513-91fe-41ce-9f15-904212ee7fa4",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        688,
        448
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "gpt-4o"
        },
        "options": {
          "temperature": 0.1
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "581b4789-530f-44f4-8773-67cf66826245",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        864,
        432
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"supply_chain_id\": {\n      \"type\": \"string\"\n    },\n    \"supplier_id\": {\n      \"type\": \"string\"\n    },\n    \"emissions_metric\": {\n      \"type\": \"number\"\n    },\n    \"resource_usage\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"energy_kwh\": {\n          \"type\": \"number\"\n        },\n        \"water_liters\": {\n          \"type\": \"number\"\n        },\n        \"materials_kg\": {\n          \"type\": \"number\"\n        }\n      }\n    },\n    \"risk_level\": {\n      \"type\": \"string\",\n      \"enum\": [\"critical\", \"high\", \"medium\", \"low\"]\n    },\n    \"recommended_action\": {\n      \"type\": \"string\"\n    },\n    \"priority_score\": {\n      \"type\": \"number\",\n      \"minimum\": 0,\n      \"maximum\": 100\n    },\n    \"confidence_level\": {\n      \"type\": \"number\",\n      \"minimum\": 0,\n      \"maximum\": 1\n    },\n    \"analysis_timestamp\": {\n      \"type\": \"string\"\n    },\n    \"bottlenecks\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    },\n    \"circular_economy_score\": {\n      \"type\": \"number\",\n      \"minimum\": 0,\n      \"maximum\": 100\n    },\n    \"logistics_efficiency_score\": {\n      \"type\": \"number\",\n      \"minimum\": 0,\n      \"maximum\": 100\n    }\n  }\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "8a10ce14-2421-46f6-a687-056e718fcfbd",
      "name": "Route by Risk Level",
      "type": "n8n-nodes-base.switch",
      "position": [
        1072,
        192
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Critical",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.risk_level }}",
                    "rightValue": "critical"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "High",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.risk_level }}",
                    "rightValue": "high"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Medium",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.risk_level }}",
                    "rightValue": "medium"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "06d877f6-2863-42f8-b41d-b1e1d8658b0c",
      "name": "Format Critical Risk Alert",
      "type": "n8n-nodes-base.set",
      "position": [
        1264,
        32
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "alert_type",
              "type": "string",
              "value": "CRITICAL"
            },
            {
              "id": "id-2",
              "name": "subject",
              "type": "string",
              "value": "=\ud83d\udea8 CRITICAL: Supply Chain Environmental Risk - {{ $json.supplier_id }}"
            },
            {
              "id": "id-3",
              "name": "message_body",
              "type": "string",
              "value": "=CRITICAL ENVIRONMENTAL RISK DETECTED\n\nSupply Chain ID: {{ $json.supply_chain_id }}\nSupplier ID: {{ $json.supplier_id }}\nRisk Level: {{ $json.risk_level }}\nPriority Score: {{ $json.priority_score }}/100\n\nEMISSIONS METRIC: {{ $json.emissions_metric }} CO2e\n\nRESOURCE USAGE:\n- Energy: {{ $json.resource_usage.energy_kwh }} kWh\n- Water: {{ $json.resource_usage.water_liters }} liters\n- Materials: {{ $json.resource_usage.materials_kg }} kg\n\nBOTTLENECKS:\n{{ $json.bottlenecks.join(\"\\n- \") }}\n\nRECOMMENDED ACTION:\n{{ $json.recommended_action }}\n\nCircular Economy Score: {{ $json.circular_economy_score }}/100\nLogistics Efficiency: {{ $json.logistics_efficiency_score }}/100\nConfidence Level: {{ Math.round($json.confidence_level * 100) }}%\n\nAnalysis Timestamp: {{ $json.analysis_timestamp }}\n\nIMMEDIATE ACTION REQUIRED"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "95cef3f1-010c-452d-99b1-ae64c803b1c6",
      "name": "Format High Risk Alert",
      "type": "n8n-nodes-base.set",
      "position": [
        1328,
        224
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "alert_type",
              "type": "string",
              "value": "HIGH"
            },
            {
              "id": "id-2",
              "name": "subject",
              "type": "string",
              "value": "=\u26a0\ufe0f HIGH PRIORITY: Supply Chain Sustainability Issue - {{ $json.supplier_id }}"
            },
            {
              "id": "id-3",
              "name": "message_body",
              "type": "string",
              "value": "=HIGH PRIORITY ENVIRONMENTAL CONCERN\n\nSupply Chain ID: {{ $json.supply_chain_id }}\nSupplier ID: {{ $json.supplier_id }}\nRisk Level: {{ $json.risk_level }}\nPriority Score: {{ $json.priority_score }}/100\n\nEMISSIONS METRIC: {{ $json.emissions_metric }} CO2e\n\nRESOURCE USAGE:\n- Energy: {{ $json.resource_usage.energy_kwh }} kWh\n- Water: {{ $json.resource_usage.water_liters }} liters\n- Materials: {{ $json.resource_usage.materials_kg }} kg\n\nIDENTIFIED ISSUES:\n{{ $json.bottlenecks.join(\"\\n- \") }}\n\nRECOMMENDED ACTION:\n{{ $json.recommended_action }}\n\nCircular Economy Score: {{ $json.circular_economy_score }}/100\nLogistics Efficiency: {{ $json.logistics_efficiency_score }}/100\nConfidence Level: {{ Math.round($json.confidence_level * 100) }}%\n\nAnalysis Timestamp: {{ $json.analysis_timestamp }}\n\nPriority intervention recommended"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "26f05d17-daab-448b-aa72-7c85662754ef",
      "name": "Format Medium Risk Report",
      "type": "n8n-nodes-base.set",
      "position": [
        1488,
        416
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "report_type",
              "type": "string",
              "value": "MEDIUM"
            },
            {
              "id": "id-2",
              "name": "summary",
              "type": "string",
              "value": "=Medium Risk - Supply Chain: {{ $json.supply_chain_id }} | Supplier: {{ $json.supplier_id }} | Priority: {{ $json.priority_score }}/100 | Action: {{ $json.recommended_action }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "5b616073-e759-4873-8395-3b16f6f67b96",
      "name": "Send Critical Alert Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1488,
        32
      ],
      "parameters": {
        "text": "={{ $json.message_body }}",
        "options": {},
        "subject": "={{ $json.subject }}",
        "toEmail": "={{ $('Workflow Configuration').first().json.alertEmailRecipients }}",
        "fromEmail": "<__PLACEHOLDER_VALUE__Sender email address__>",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "ef4e7a1f-9feb-41e0-9695-41483b730387",
      "name": "Send High Risk Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1488,
        224
      ],
      "parameters": {
        "text": "={{ $json.message_body }}",
        "options": {},
        "subject": "={{ $json.subject }}",
        "toEmail": "={{ $('Workflow Configuration').first().json.alertEmailRecipients }}",
        "fromEmail": "<__PLACEHOLDER_VALUE__Sender email address__>",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "7e172f1c-cc84-4cd4-b272-bad10c7995eb",
      "name": "Store Analysis Results",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1712,
        224
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.storageApiUrl }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json }}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "b0394b2b-06dd-4393-8477-eae07d40e0bf",
      "name": "Emissions Calculator Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -8,
        0
      ],
      "parameters": {
        "text": "={{ $json }}",
        "options": {
          "systemMessage": "You are an emissions calculation specialist for supply chain sustainability analysis.\n\nYour task is to:\n1. Calculate total greenhouse gas emissions (CO2e, methane, N2O)\n2. Break down emissions by scope (Scope 1, 2, 3)\n3. Analyze energy consumption patterns and carbon intensity\n4. Compare emissions against industry benchmarks using the Industry Benchmark API Tool\n5. Use the Carbon Footprint Calculator Tool for precise calculations\n6. Identify high-emission processes and activities\n7. Recommend emission reduction strategies\n\nProvide detailed emissions analysis with specific metrics and reduction opportunities."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "d8616539-b720-4d31-b694-b6bd82babe59",
      "name": "Circular Economy Evaluator Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -8,
        400
      ],
      "parameters": {
        "text": "={{ $json }}",
        "options": {
          "systemMessage": "You are a circular economy specialist for supply chain sustainability analysis.\n\nYour task is to:\n1. Evaluate waste reduction and recycling practices\n2. Assess material recovery and reuse programs\n3. Analyze product lifecycle and end-of-life management\n4. Score circular economy maturity (0-100)\n5. Identify opportunities for closed-loop systems\n6. Evaluate sustainable material sourcing and recycled content usage\n7. Recommend circular economy improvements\n\nProvide comprehensive circular economy assessment with actionable recommendations."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "8a11d6b2-8dfc-49ad-bfe7-257923155182",
      "name": "Logistics Optimizer Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -8,
        904
      ],
      "parameters": {
        "text": "={{ $json }}",
        "options": {
          "systemMessage": "You are a logistics optimization specialist for supply chain sustainability analysis.\n\nYour task is to:\n1. Analyze transportation modes and route efficiency\n2. Calculate logistics carbon footprint\n3. Evaluate warehouse and distribution center efficiency\n4. Assess packaging optimization and waste\n5. Score logistics efficiency (0-100)\n6. Identify route optimization opportunities\n7. Recommend sustainable logistics improvements (electric vehicles, route consolidation, modal shifts)\n\nProvide detailed logistics analysis with specific optimization strategies."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "e9778424-8549-4d91-bb14-d6a96145928d",
      "name": "OpenAI Chat Model 2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -128,
        224
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "gpt-4o"
        },
        "options": {
          "temperature": 0.1
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "58196da6-b08d-4aaf-9ac2-9be7f990476b",
      "name": "OpenAI Chat Model 3",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -32,
        640
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "gpt-4o"
        },
        "options": {
          "temperature": 0.1
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "eb10dfc9-3c67-4d0a-8ef6-ad4d1db17d36",
      "name": "OpenAI Chat Model 4",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -48,
        1120
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "gpt-4o"
        },
        "options": {
          "temperature": 0.1
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "b423dbbc-ae1b-45c5-b13e-3799d9f1b355",
      "name": "Emissions Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        240,
        176
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"total_emissions_co2e\": {\n      \"type\": \"number\"\n    },\n    \"scope_1_emissions\": {\n      \"type\": \"number\"\n    },\n    \"scope_2_emissions\": {\n      \"type\": \"number\"\n    },\n    \"scope_3_emissions\": {\n      \"type\": \"number\"\n    },\n    \"carbon_intensity\": {\n      \"type\": \"number\"\n    },\n    \"benchmark_comparison\": {\n      \"type\": \"string\"\n    },\n    \"high_emission_sources\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    },\n    \"reduction_opportunities\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    }\n  }\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "e34f09f9-8263-4588-96f8-5eef73ed3d89",
      "name": "Circular Economy Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        128,
        624
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"circular_economy_score\": {\n      \"type\": \"number\",\n      \"minimum\": 0,\n      \"maximum\": 100\n    },\n    \"waste_diversion_rate\": {\n      \"type\": \"number\"\n    },\n    \"material_recovery_rate\": {\n      \"type\": \"number\"\n    },\n    \"recycled_content_percentage\": {\n      \"type\": \"number\"\n    },\n    \"product_lifecycle_score\": {\n      \"type\": \"number\"\n    },\n    \"closed_loop_opportunities\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    },\n    \"improvement_recommendations\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    }\n  }\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "99e68777-873b-4a6d-bba7-496bf3eb99db",
      "name": "Logistics Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        128,
        1128
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"logistics_efficiency_score\": {\n      \"type\": \"number\",\n      \"minimum\": 0,\n      \"maximum\": 100\n    },\n    \"transportation_carbon_footprint\": {\n      \"type\": \"number\"\n    },\n    \"route_efficiency_percentage\": {\n      \"type\": \"number\"\n    },\n    \"modal_split\": {\n      \"type\": \"object\"\n    },\n    \"packaging_waste_kg\": {\n      \"type\": \"number\"\n    },\n    \"optimization_opportunities\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    },\n    \"recommended_improvements\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    }\n  }\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "39723616-93b7-4aba-aba7-2591e46b06b4",
      "name": "Carbon Footprint Calculator Tool",
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "position": [
        32,
        224
      ],
      "parameters": {
        "jsCode": "// Carbon Footprint Calculator\n// Calculates CO2 emissions from energy, transportation, and materials\n\n// Parse the input query (expecting JSON string or object)\nlet input;\ntry {\n  input = typeof query === 'string' ? JSON.parse(query) : query;\n} catch (e) {\n  return 'Error: Invalid input format. Expected JSON with energy_kwh, transportation_km, fuel_type, and materials_kg';\n}\n\n// Emission factors (kg CO2e per unit)\nconst EMISSION_FACTORS = {\n  // Energy: kg CO2e per kWh\n  energy: 0.5, // Average grid electricity\n  \n  // Transportation: kg CO2e per km\n  fuel_types: {\n    diesel: 0.27,\n    gasoline: 0.24,\n    electric: 0.05,\n    hybrid: 0.12,\n    air_freight: 1.13,\n    sea_freight: 0.01\n  },\n  \n  // Materials: kg CO2e per kg (production emissions)\n  materials: {\n    steel: 1.85,\n    aluminum: 8.24,\n    plastic: 3.79,\n    paper: 1.32,\n    glass: 0.85,\n    default: 2.0\n  }\n};\n\n// Calculate energy emissions\nconst energyEmissions = (input.energy_kwh || 0) * EMISSION_FACTORS.energy;\n\n// Calculate transportation emissions\nconst fuelType = (input.fuel_type || 'diesel').toLowerCase();\nconst transportFactor = EMISSION_FACTORS.fuel_types[fuelType] || EMISSION_FACTORS.fuel_types.diesel;\nconst transportEmissions = (input.transportation_km || 0) * transportFactor;\n\n// Calculate material emissions\nconst materialType = (input.material_type || 'default').toLowerCase();\nconst materialFactor = EMISSION_FACTORS.materials[materialType] || EMISSION_FACTORS.materials.default;\nconst materialEmissions = (input.materials_kg || 0) * materialFactor;\n\n// Total carbon footprint\nconst totalEmissions = energyEmissions + transportEmissions + materialEmissions;\n\n// Return detailed breakdown\nconst result = {\n  total_co2e_kg: Math.round(totalEmissions * 100) / 100,\n  breakdown: {\n    energy_emissions: Math.round(energyEmissions * 100) / 100,\n    transport_emissions: Math.round(transportEmissions * 100) / 100,\n    material_emissions: Math.round(materialEmissions * 100) / 100\n  },\n  inputs: {\n    energy_kwh: input.energy_kwh || 0,\n    transportation_km: input.transportation_km || 0,\n    fuel_type: fuelType,\n    materials_kg: input.materials_kg || 0,\n    material_type: materialType\n  },\n  emission_factors_used: {\n    energy: EMISSION_FACTORS.energy,\n    transport: transportFactor,\n    material: materialFactor\n  }\n};\n\nreturn JSON.stringify(result, null, 2);",
        "description": "Calculates carbon footprint from energy consumption, transportation, and material usage data"
      },
      "typeVersion": 1.3
    },
    {
      "id": "2e5b1c69-597d-44e5-907b-cbe2e4995f13",
      "name": "Industry Benchmark API Tool",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        176,
        240
      ],
      "parameters": {
        "url": "<__PLACEHOLDER_VALUE__Industry benchmark API endpoint__>",
        "options": {},
        "toolDescription": "Fetches industry-specific sustainability benchmarks and standards"
      },
      "typeVersion": 4.3
    },
    {
      "id": "010b1108-d26c-4557-8a01-52d577aacf0f",
      "name": "Merge Agent Results",
      "type": "n8n-nodes-base.set",
      "position": [
        464,
        224
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "emissions_data",
              "type": "object",
              "value": "={{ $('Emissions Calculator Agent').first().json }}"
            },
            {
              "id": "id-2",
              "name": "circular_economy_data",
              "type": "object",
              "value": "={{ $('Circular Economy Evaluator Agent').first().json }}"
            },
            {
              "id": "id-3",
              "name": "logistics_data",
              "type": "object",
              "value": "={{ $('Logistics Optimizer Agent').first().json }}"
            },
            {
              "id": "id-4",
              "name": "combined_analysis_timestamp",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "fa614927-50d5-4ab4-8173-5f49674f575b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        -592
      ],
      "parameters": {
        "color": 4,
        "width": 496,
        "height": 368,
        "content": "## Prerequisites\nActive OpenAI API account with sufficient credits, supply chain management system with API access\n## Use Cases\nDaily supply chain health monitoring, supplier risk assessment, inventory shortage prediction\n## Customization\nModify agent prompts for industry-specific analysis, adjust risk scoring algorithms\n## Benefits\nProvides 360-degree supply chain visibility, enables proactive risk mitigation"
      },
      "typeVersion": 1
    },
    {
      "id": "670edb63-b45b-44db-bd5f-9f3abde0032d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        -528
      ],
      "parameters": {
        "width": 400,
        "height": 304,
        "content": "## Setup Steps\n1. Configure Schedule Trigger with desired monitoring frequency \n2. Set up OpenAI API credentials for all four AI agent nodes\n3. Configure Fetch Supply Chain Data node with your ERP/SCM system API endpoint\n4. Customize Enterprise Executor Agent tools with your strategic KPIs\n5. Update Provider Generator Agent with supplier evaluation criteria\n6. Configure Circular Economy Agent with sustainability metrics and targets"
      },
      "typeVersion": 1
    },
    {
      "id": "ba89220f-01e2-468d-96e3-29f107641ffe",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -848,
        -496
      ],
      "parameters": {
        "width": 800,
        "height": 240,
        "content": "## How It Works\nThis workflow automates supply chain monitoring and risk management by deploying multiple specialized AI agents to analyze different supply chain dimensions simultaneously. Designed for supply chain managers, procurement teams, and logistics coordinators, it solves the critical challenge of real-time supply chain visibility and proactive risk mitigation across complex global networks. The system triggers on schedule, fetches current supply chain data, then deploys four specialized AI agents\u2014Enterprise Executor for strategic coordination, Provider Generator for supplier assessment, Circular Economy analyzer for sustainability metrics, and Logistics Optimizer for distribution efficiency. Each agent leverages OpenAI models with dedicated tools for calculations and data parsing. Results are merged, analyzed for risk levels (critical, high, normal), and routed to appropriate stakeholders via email with risk-specific formatting and urgency levels."
      },
      "typeVersion": 1
    },
    {
      "id": "ab7c279c-a0d6-4161-b398-f0a4cd5ebf6e",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 1440,
        "height": 1392,
        "content": "## Scheduled Data Acquisition and Multi-Agent Deployment\n**Why:** Triggers automated supply chain data retrieval at configured intervals, then simultaneously deploys four specialized AI agents (Enterprise, Provider, Circular Economy, Logistics) each analyzing distinct supply chain dimensions "
      },
      "typeVersion": 1
    },
    {
      "id": "6ba013c3-8603-4136-87eb-40e66c061f8d",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 832,
        "height": 784,
        "content": "## Risk-Based Alert Routing and Notification\n**Why:** Consolidates multi-agent findings, determines risk severity levels, routes critical alerts to executives via formatted email, high-risk issues to managers, and standard reports to operations teams, ensuring appropriate stakeholders receive actionable intelligence with urgency matching threat level."
      },
      "typeVersion": 1
    },
    {
      "id": "0af71c4e-c341-4840-bbba-d19eb88f2721",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 784,
        "content": "## Parallel AI Analysis with Specialized Tools\n**Why:** Each agent processes supply chain data using OpenAI models equipped with domain-specific tools including calculators for metrics, output parsers for structured results, and benchmark tools, generating insights on supplier performance "
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "424a009d-d946-423a-b71b-1bf4f644d51e",
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Supply Chain Sustainability Analyzer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Merge Agent Results": {
      "main": [
        [
          {
            "node": "Supply Chain Sustainability Analyzer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model 2": {
      "ai_languageModel": [
        [
          {
            "node": "Emissions Calculator Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model 3": {
      "ai_languageModel": [
        [
          {
            "node": "Circular Economy Evaluator Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model 4": {
      "ai_languageModel": [
        [
          {
            "node": "Logistics Optimizer Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Route by Risk Level": {
      "main": [
        [
          {
            "node": "Format Critical Risk Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Format High Risk Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Format Medium Risk Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send High Risk Email": {
      "main": [
        [
          {
            "node": "Store Analysis Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format High Risk Alert": {
      "main": [
        [
          {
            "node": "Send High Risk Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Fetch Supply Chain Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Emissions Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Emissions Calculator Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Supply Chain Data": {
      "main": [
        [
          {
            "node": "Emissions Calculator Agent",
            "type": "main",
            "index": 0
          },
          {
            "node": "Circular Economy Evaluator Agent",
            "type": "main",
            "index": 0
          },
          {
            "node": "Logistics Optimizer Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Logistics Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Logistics Optimizer Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Supply Chain Sustainability Analyzer",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Format Medium Risk Report": {
      "main": [
        [
          {
            "node": "Store Analysis Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Logistics Optimizer Agent": {
      "main": [
        [
          {
            "node": "Merge Agent Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Critical Alert Email": {
      "main": [
        [
          {
            "node": "Store Analysis Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Emissions Calculator Agent": {
      "main": [
        [
          {
            "node": "Merge Agent Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Critical Risk Alert": {
      "main": [
        [
          {
            "node": "Send Critical Alert Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Industry Benchmark API Tool": {
      "ai_tool": [
        [
          {
            "node": "Emissions Calculator Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Circular Economy Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Circular Economy Evaluator Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Carbon Footprint Calculator Tool": {
      "ai_tool": [
        [
          {
            "node": "Emissions Calculator Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Circular Economy Evaluator Agent": {
      "main": [
        [
          {
            "node": "Merge Agent Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supply Chain Sustainability Analyzer": {
      "main": [
        [
          {
            "node": "Route by Risk Level",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

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

About this workflow

This workflow automates supply chain monitoring and risk management by deploying multiple specialized AI agents to analyze different supply chain dimensions simultaneously. Designed for supply chain managers, procurement teams, and logistics coordinators, it solves the critical…

Source: https://n8n.io/workflows/12988/ — 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

This workflow automates end-to-end ESG (Environmental, Social, and Governance) sustainability reporting for enterprise sustainability teams, compliance officers, and green governance leads. It solves

Agent, OpenAI Chat, Output Parser Structured +12
AI & RAG

Automated daily scraping of competitor websites, pricing pages, job postings, and press releases feeds into an AI analyzer powered by OpenAI or Claude to extract trends, insights, and key metrics. The

HTTP Request, Agent, OpenAI Chat +5
AI & RAG

This workflow automates energy portfolio governance for energy managers, sustainability teams, and policy compliance officers. It eliminates the manual effort of aggregating multi-source energy data,

HTTP Request, Agent, OpenAI Chat +9
AI & RAG

Schedules automated vendor pricing analysis across multiple sources. Fetches delivery reliability and contract data, analyzes vendor performance using Claude AI, then distributes consolidated reports

HTTP Request, Airtable, OpenAI Chat +9
AI & RAG

This workflow automates performance governance and policy compliance monitoring for HR leaders, talent managers, and organizational development teams across enterprises. It solves the challenge of mai

HTTP Request, OpenAI Chat, Output Parser Structured +5