This workflow corresponds to n8n.io template #13318 — we link there as the canonical source.
This workflow follows the Agent → Datatable 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 →
{
"id": "WkOXSh7R2J8Ghya6QFqLl",
"name": "AI-Driven Policy Monitoring and Compliance Orchestration System",
"tags": [],
"nodes": [
{
"id": "f0df187a-a4f2-42d1-8e39-bb4530089a0b",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-1392,
304
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 9
}
]
}
},
"typeVersion": 1.3
},
{
"id": "c8ac420f-7ed5-42af-a6de-6c2e3ab2ccd4",
"name": "Workflow Configuration",
"type": "n8n-nodes-base.set",
"position": [
-1168,
304
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "id-1",
"name": "policyTableName",
"type": "string",
"value": "employee_policy_records"
},
{
"id": "id-2",
"name": "complianceTableName",
"type": "string",
"value": "compliance_actions_log"
},
{
"id": "id-3",
"name": "auditTableName",
"type": "string",
"value": "audit_reports"
},
{
"id": "id-4",
"name": "executionLogTableName",
"type": "string",
"value": "workflow_execution_log"
},
{
"id": "id-5",
"name": "slackChannel",
"type": "string",
"value": "<__PLACEHOLDER_VALUE__Slack Channel ID for compliance alerts__>"
},
{
"id": "id-6",
"name": "escalationEmail",
"type": "string",
"value": "<__PLACEHOLDER_VALUE__Email address for escalations__>"
},
{
"id": "id-7",
"name": "complianceThresholdDays",
"type": "number",
"value": 30
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "28aace8a-2a82-4b78-a9a3-19d9d65c3652",
"name": "Fetch Policy Records",
"type": "n8n-nodes-base.dataTable",
"position": [
-944,
304
],
"parameters": {
"operation": "get",
"returnAll": true,
"dataTableId": {
"__rl": true,
"mode": "name",
"value": "={{ $('Workflow Configuration').first().json.policyTableName }}"
}
},
"typeVersion": 1.1
},
{
"id": "7de29645-dc4d-4343-b080-b1216dd46250",
"name": "Policy Monitoring Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-720,
304
],
"parameters": {
"text": "=Employee Policy Data: {{ JSON.stringify($json) }}",
"options": {
"systemMessage": "You are a Policy Monitoring Agent specialized in validating employee compliance with training, certification, and policy acknowledgement requirements.\n\nYour task is to:\n1. Analyze employee policy records including training completion dates, certification expiration dates, and policy acknowledgement timestamps\n2. Determine the overall compliance status (compliant, at_risk, non_compliant)\n3. Calculate days until next expiration or days overdue\n4. Assess risk level (low, medium, high, critical) based on:\n - Number of days until expiration or overdue\n - Type of requirement (training, certification, policy)\n - Criticality of the requirement\n5. Determine required action (none, reminder, escalation)\n6. Evaluate individual status for training, certification, and policy acknowledgement\n7. Provide detailed reasoning for your assessment\n\nCompliance Rules:\n- Compliant: All requirements are current and valid for at least 30 days\n- At Risk: One or more requirements expire within 30 days\n- Non-Compliant: One or more requirements are expired or overdue\n\nRisk Level Guidelines:\n- Low: Compliant with 60+ days until next expiration\n- Medium: At risk with 15-30 days until expiration\n- High: At risk with less than 15 days until expiration\n- Critical: Non-compliant with expired requirements\n\nRequired Action:\n- None: Compliant with low risk\n- Reminder: At risk or medium risk\n- Escalation: High or critical risk\n\nReturn structured output with all required fields."
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 3.1
},
{
"id": "baa01df0-9072-4b95-ac91-43c59fad7c05",
"name": "OpenAI Model - Policy Agent",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-752,
528
],
"parameters": {
"model": {
"__rl": true,
"mode": "id",
"value": "gpt-4o"
},
"options": {
"temperature": 0.2
},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "251cd2a1-6ec0-439d-81eb-e66761827e4e",
"name": "Policy Validation Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
-576,
528
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"employeeId\": {\n \"type\": \"string\",\n \"description\": \"Employee identifier\"\n },\n \"employeeName\": {\n \"type\": \"string\",\n \"description\": \"Employee full name\"\n },\n \"complianceStatus\": {\n \"type\": \"string\",\n \"enum\": [\"compliant\", \"at_risk\", \"non_compliant\"],\n \"description\": \"Overall compliance status\"\n },\n \"riskLevel\": {\n \"type\": \"string\",\n \"enum\": [\"low\", \"medium\", \"high\", \"critical\"],\n \"description\": \"Risk level based on compliance gaps\"\n },\n \"daysUntilExpiration\": {\n \"type\": \"number\",\n \"description\": \"Days until next expiration (negative if overdue)\"\n },\n \"requiredAction\": {\n \"type\": \"string\",\n \"enum\": [\"none\", \"reminder\", \"escalation\"],\n \"description\": \"Action required for this employee\"\n },\n \"trainingStatus\": {\n \"type\": \"string\",\n \"description\": \"Training completion status\"\n },\n \"certificationStatus\": {\n \"type\": \"string\",\n \"description\": \"Certification validity status\"\n },\n \"policyAcknowledgementStatus\": {\n \"type\": \"string\",\n \"description\": \"Policy acknowledgement status\"\n },\n \"reasoning\": {\n \"type\": \"string\",\n \"description\": \"Detailed explanation of the compliance assessment\"\n }\n },\n \"required\": [\"employeeId\", \"complianceStatus\", \"riskLevel\", \"requiredAction\", \"reasoning\"]\n}"
},
"typeVersion": 1.3
},
{
"id": "ac703572-2cd9-4b8a-bf5d-d02d91b01df2",
"name": "Route by Compliance Status",
"type": "n8n-nodes-base.switch",
"position": [
-368,
288
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Non-Compliant",
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output.complianceStatus }}",
"rightValue": "non_compliant"
},
{
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output.complianceStatus }}",
"rightValue": "at_risk"
}
]
},
"renameOutput": true
},
{
"outputKey": "Compliant",
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output.complianceStatus }}",
"rightValue": "compliant"
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "extra",
"renameFallbackOutput": "Unknown"
}
},
"typeVersion": 3.4
},
{
"id": "1ad6c32d-03c5-4cd7-8448-ab2079feb9c8",
"name": "Compliance Orchestration Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
0,
160
],
"parameters": {
"text": "=Compliance Issue: {{ JSON.stringify($json.output) }}",
"options": {
"systemMessage": "You are a Compliance Orchestration Agent responsible for managing compliance reminders, escalations, and audit reporting.\n\nYour task is to:\n1. Analyze non-compliant or at-risk employee records\n2. Determine the appropriate communication strategy based on risk level and required action\n3. Use available tools to send notifications and execute escalations:\n - Slack Notification Tool: Send alerts to compliance team channels\n - Email Notification Tool: Send formal notifications to employees and managers\n - Escalation Logic Tool: Execute escalation workflows for critical violations\n4. Coordinate multi-channel notifications when necessary\n5. Ensure all actions are logged for audit purposes\n\nNotification Strategy:\n- For \"reminder\" actions: Send friendly reminder via email to employee\n- For \"escalation\" actions with medium/high risk: Send email to employee and Slack alert to compliance team\n- For \"escalation\" actions with critical risk: Execute full escalation logic, send emails to all stakeholders, and post urgent Slack alerts\n\nWhen using tools:\n- Slack messages should be concise and include: employee name, risk level, days overdue/until expiration, and required action\n- Email subjects should clearly indicate urgency level\n- Email bodies should be professional and include specific compliance requirements and deadlines\n- Always call Escalation Logic Tool for critical risk cases to determine proper escalation path\n\nYour goal is to ensure timely compliance while maintaining professional communication standards."
},
"promptType": "define"
},
"typeVersion": 3.1
},
{
"id": "18c240cb-6fe0-4b15-ae25-a4a09dd7fe4c",
"name": "OpenAI Model - Compliance Agent",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-96,
352
],
"parameters": {
"model": {
"__rl": true,
"mode": "id",
"value": "gpt-4o"
},
"options": {
"temperature": 0.3
},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "aa62539d-9d9e-481d-8971-eb2e8a9bc069",
"name": "Slack Notification Tool",
"type": "n8n-nodes-base.slackTool",
"position": [
48,
384
],
"parameters": {
"text": "={{ $fromAI('message', 'Compliance alert message to send', 'string') }}",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "id",
"value": "={{ $fromAI('slackChannel', 'Slack channel ID for compliance alerts', 'string', $('Workflow Configuration').first().json.slackChannel) }}"
},
"otherOptions": {},
"authentication": "oAuth2"
},
"credentials": {
"slackOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 2.4
},
{
"id": "d64a8c6e-c22d-44ca-92ab-d9b45e608383",
"name": "Email Notification Tool",
"type": "n8n-nodes-base.emailSendTool",
"position": [
192,
384
],
"parameters": {
"message": "={{ $fromAI('emailBody', 'Email message body', 'string') }}",
"options": {},
"subject": "={{ $fromAI('emailSubject', 'Email subject line', 'string') }}",
"toEmail": "={{ $fromAI('recipientEmail', 'Email address of recipient', 'string') }}",
"fromEmail": "<__PLACEHOLDER_VALUE__Sender email address for compliance notifications__>",
"operation": "sendAndWait"
},
"typeVersion": 2.1
},
{
"id": "e3288ae8-382b-4008-86ea-eea71e81cb43",
"name": "Escalation Logic Tool",
"type": "@n8n/n8n-nodes-langchain.toolCode",
"position": [
336,
432
],
"parameters": {
"jsCode": "const complianceData = $fromAI('complianceData', 'The compliance issue data requiring escalation', 'json');\n\ntry {\n const data = typeof complianceData === 'string' ? JSON.parse(complianceData) : complianceData;\n \n const riskLevel = data.riskLevel || 'medium';\n const daysOverdue = Math.abs(data.daysUntilExpiration || 0);\n const employeeName = data.employeeName || 'Unknown Employee';\n const employeeId = data.employeeId || 'Unknown ID';\n \n let escalationPath = [];\n let urgency = 'normal';\n let requiredActions = [];\n \n if (riskLevel === 'critical' || daysOverdue > 60) {\n escalationPath = ['Direct Manager', 'Department Head', 'HR Director', 'Compliance Officer'];\n urgency = 'immediate';\n requiredActions = [\n 'Immediate manager notification',\n 'HR intervention required',\n 'Compliance review meeting',\n 'Potential disciplinary action'\n ];\n } else if (riskLevel === 'high' || daysOverdue > 30) {\n escalationPath = ['Direct Manager', 'HR Representative'];\n urgency = 'high';\n requiredActions = [\n 'Manager notification',\n 'HR follow-up',\n 'Compliance deadline extension review'\n ];\n } else {\n escalationPath = ['Direct Manager'];\n urgency = 'normal';\n requiredActions = [\n 'Manager awareness',\n 'Employee reminder'\n ];\n }\n \n const escalationReport = {\n employeeId: employeeId,\n employeeName: employeeName,\n riskLevel: riskLevel,\n daysOverdue: daysOverdue,\n urgency: urgency,\n escalationPath: escalationPath,\n requiredActions: requiredActions,\n escalationDate: new Date().toISOString(),\n summary: `${urgency.toUpperCase()} escalation required for ${employeeName} (${employeeId}). Risk: ${riskLevel}. Days overdue: ${daysOverdue}. Escalation path: ${escalationPath.join(' \u2192 ')}.`\n };\n \n return JSON.stringify(escalationReport, null, 2);\n \n} catch (error) {\n return JSON.stringify({\n error: 'Escalation logic failed',\n message: error.message,\n escalationPath: ['HR Director'],\n urgency: 'high'\n });\n}",
"description": "Executes escalation logic for critical compliance violations, determines escalation path and required stakeholders"
},
"typeVersion": 1.3
},
{
"id": "bd1e100d-8985-4923-9a34-a85189b9fa57",
"name": "Log Compliance Actions",
"type": "n8n-nodes-base.dataTable",
"position": [
496,
256
],
"parameters": {
"columns": {
"value": null,
"mappingMode": "autoMapInputData"
},
"options": {},
"operation": "upsert",
"dataTableId": {
"__rl": true,
"mode": "name",
"value": "={{ $('Workflow Configuration').first().json.complianceTableName }}"
}
},
"typeVersion": 1.1
},
{
"id": "4f4fa2cb-6425-48d8-9476-eb0b50f48456",
"name": "Prepare Compliant Records",
"type": "n8n-nodes-base.set",
"position": [
48,
592
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "id-1",
"name": "auditStatus",
"type": "string",
"value": "compliant"
},
{
"id": "id-2",
"name": "auditDate",
"type": "string",
"value": "={{ $now.toISO() }}"
},
{
"id": "id-3",
"name": "auditType",
"type": "string",
"value": "automated_policy_check"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "1c7b46a8-2c87-4398-9bca-c3e72b835400",
"name": "Store Audit Report",
"type": "n8n-nodes-base.dataTable",
"position": [
512,
592
],
"parameters": {
"columns": {
"value": null,
"mappingMode": "autoMapInputData"
},
"options": {},
"operation": "upsert",
"dataTableId": {
"__rl": true,
"mode": "name",
"value": "={{ $('Workflow Configuration').first().json.auditTableName }}"
}
},
"typeVersion": 1.1
},
{
"id": "fd381a95-15b1-4a31-b91f-b440edc3d6a1",
"name": "Merge All Actions",
"type": "n8n-nodes-base.merge",
"position": [
720,
400
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineByPosition"
},
"typeVersion": 3.2
},
{
"id": "2374286f-5f21-45ff-abc7-2df6d07e8690",
"name": "Final Execution Log",
"type": "n8n-nodes-base.dataTable",
"position": [
912,
400
],
"parameters": {
"columns": {
"value": null,
"mappingMode": "autoMapInputData"
},
"options": {},
"operation": "upsert",
"dataTableId": {
"__rl": true,
"mode": "name",
"value": "={{ $('Workflow Configuration').first().json.executionLogTableName }}"
}
},
"typeVersion": 1.1
},
{
"id": "98f589b1-266a-4208-89c0-d41f2dc85c03",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1312,
-288
],
"parameters": {
"width": 576,
"height": 288,
"content": "## How It Works\nThis workflow automates enterprise policy compliance monitoring using AI agents to ensure organizational adherence to regulatory and internal policies. Designed for compliance officers, legal teams, and risk managers, it solves the challenge of manually reviewing vast policy documents and execution logs for violations.The system fetches policy records on schedule, routes them to specialized AI agents (OpenAI for compliance assessment and escalation logic), validates outputs, and logs all actions for audit trails. Email notifications alert stakeholders when violations occur. By automating detection and escalation, organizations reduce compliance risks, accelerate response times, and maintain comprehensive audit documentation\u2014critical for regulated industries like finance, healthcare, and manufacturing."
},
"typeVersion": 1
},
{
"id": "5f0df633-d18b-44ca-8c9a-2247f1da29a9",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-720,
-304
],
"parameters": {
"width": 400,
"height": 304,
"content": "## Setup Steps\n1. Connect **Schedule Trigger** (set monitoring frequency: hourly/daily)\n2. Configure **Fetch Policy Records** node with your policy database/API credentials\n3. Add **OpenAI API key** to Compliance Agent and Escalation Logic nodes\n4. Connect **Email** node with SMTP credentials for alert notifications\n5. Link **Final Execution Log** to your audit storage system \n6. Test workflow with sample policy violations to verify routing logic"
},
"typeVersion": 1
},
{
"id": "0615c803-149a-4177-b28e-82cb013756fe",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-288,
-320
],
"parameters": {
"color": 4,
"width": 544,
"height": 320,
"content": "## Prerequisites\nOpenAI API account with GPT-4 access, policy database/API access\n## Use Cases\nFinancial services regulatory compliance (KYC/AML), healthcare HIPAA monitoring\n## Customization\nModify AI prompts for industry-specific regulations, adjust routing thresholds for violation severity\n## Benefits\nReduces compliance review time by 90%, eliminates human oversight gaps"
},
"typeVersion": 1
},
{
"id": "3522da3d-2c27-4b6f-9383-d56f0227fb8e",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
448,
64
],
"parameters": {
"color": 7,
"width": 672,
"height": 784,
"content": "## Escalation & Notification\n**Why**: Enables rapid stakeholder response and creates immutable compliance trails"
},
"typeVersion": 1
},
{
"id": "9bf40575-92cd-47fe-aafc-0082106e8f16",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-400,
64
],
"parameters": {
"color": 7,
"width": 832,
"height": 768,
"content": "## Intelligent Routing\n**Why**: Prioritizes critical issues for immediate action while logging minor infractions"
},
"typeVersion": 1
},
{
"id": "d80e388d-b6e3-445e-bc55-1da2b8c250f7",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1440,
64
],
"parameters": {
"color": 7,
"width": 1008,
"height": 720,
"content": "## Scheduled Monitoring & AI Compliance Assessment\n**Why**: OpenAI agent analyzes policy records against compliance rules to ensure continuous monitoring and scales expert-level policy interpretation across thousands of documents instantly"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"availableInMCP": false,
"executionOrder": "v1"
},
"versionId": "d3fe34fe-44ad-4fcf-9a51-0c6c1be7b60c",
"connections": {
"Schedule Trigger": {
"main": [
[
{
"node": "Workflow Configuration",
"type": "main",
"index": 0
}
]
]
},
"Merge All Actions": {
"main": [
[
{
"node": "Final Execution Log",
"type": "main",
"index": 0
}
]
]
},
"Store Audit Report": {
"main": [
[
{
"node": "Merge All Actions",
"type": "main",
"index": 1
}
]
]
},
"Fetch Policy Records": {
"main": [
[
{
"node": "Policy Monitoring Agent",
"type": "main",
"index": 0
}
]
]
},
"Escalation Logic Tool": {
"ai_tool": [
[
{
"node": "Compliance Orchestration Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Log Compliance Actions": {
"main": [
[
{
"node": "Merge All Actions",
"type": "main",
"index": 0
}
]
]
},
"Workflow Configuration": {
"main": [
[
{
"node": "Fetch Policy Records",
"type": "main",
"index": 0
}
]
]
},
"Email Notification Tool": {
"ai_tool": [
[
{
"node": "Compliance Orchestration Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Policy Monitoring Agent": {
"main": [
[
{
"node": "Route by Compliance Status",
"type": "main",
"index": 0
}
]
]
},
"Slack Notification Tool": {
"ai_tool": [
[
{
"node": "Compliance Orchestration Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Prepare Compliant Records": {
"main": [
[
{
"node": "Store Audit Report",
"type": "main",
"index": 0
}
]
]
},
"Route by Compliance Status": {
"main": [
[
{
"node": "Compliance Orchestration Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "Prepare Compliant Records",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Model - Policy Agent": {
"ai_languageModel": [
[
{
"node": "Policy Monitoring Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Compliance Orchestration Agent": {
"main": [
[
{
"node": "Log Compliance Actions",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Model - Compliance Agent": {
"ai_languageModel": [
[
{
"node": "Compliance Orchestration Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Policy Validation Output Parser": {
"ai_outputParser": [
[
{
"node": "Policy Monitoring Agent",
"type": "ai_outputParser",
"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.
openAiApislackOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow automates enterprise policy compliance monitoring using AI agents to ensure organizational adherence to regulatory and internal policies. Designed for compliance officers, legal teams, and risk managers, it solves the challenge of manually reviewing vast policy…
Source: https://n8n.io/workflows/13318/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
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
This workflow automates semiconductor board-level reliability monitoring using AI agents. It targets reliability engineers, manufacturing teams, and quality analysts. The system collects capacity, his
This workflow automates procurement fraud detection and supplier compliance monitoring for organizations managing complex purchasing operations. Designed for procurement teams, audit departments, and
This workflow automates end-to-end sustainability lifecycle management for corporate sustainability teams, ESG governance officers, and circular economy programme leads. It addresses the challenge of
This workflow automates medical imaging analysis and diagnostic reporting for radiology departments, imaging centers, and hospital networks managing high patient volumes. Designed for radiologists, me