Skip to main content

Automated document compliance validation with AI and vector database

Workflow preview

Workflow preview
100%
Automated document compliance validation with AI and vector database preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Description This workflow automates compliance validation between a policy/procedure and a corresponding uploaded document. It leverages an AI agent to determine whether the content of the document...

Best for

  • AI RAG automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.webhook, n8n-nodes-base.httprequest, @n8n/n8n-nodes-langchain.code, n8n-nodes-base.extractfromfile, @n8n/n8n-nodes-langchain.embeddingsollama, @n8n/n8n-nodes-langchain.vectorstoreqdrant, @n8n/n8n-nodes-langchain.documentdefaultdataloader, @n8n/n8n-nodes-langchain.textsplitterrecursivecharactertextsplitter

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Thapani Sawaengsri.

Original n8n.io source

1.1 Workflow description

Title
Automated document compliance validation with AI and vector database
Workflow name
Automated document compliance validation with AI and vector database

Description

This workflow automates compliance validation between a policy/procedure and a corresponding uploaded document. It leverages an AI agent to determine whether the content of the document aligns with the expectations outlined in the provided procedure or policy.

How It Works

  1. Document Upload
  • A document (e.g., PDF) is uploaded via an HTTP Request Webhook.

  • The content is processed into vector embeddings using a Qdrant vector store and an embedding model.

  1. Procedure Submission
  • A policy/procedure text and description are submitted via a second HTTP Request Webhook.

  • These serve as the basis for evaluating the uploaded document.

  1. AI-Based Validation

The AI agent receives:

  • The uploaded document (via vector embeddings)

  • The submitted procedure/policy text

  • The description/context

It returns a structured compliance analysis including:

  • Summary of Compliance (sections that align with policy)

  • Summary of Non-Compliance (gaps or missing elements)

  • Supporting Text Citations (document evidence)

  • Confidence Level (0–100 score based on evidence quality)

Setup Instructions

Pre-Conditions / Requirements

  • An n8n instance running with access to:

  • Qdrant (for vector storage)

  • An embedding model (e.g., OpenAI, HuggingFace, or local model)

  • Optional: Microsoft Graph or another storage system for document retrieval.

Workflow Setup

  1. HTTP Request Node 1: Document Upload

Accepts binary document files (PDF, DOCX, etc.).

Extracts text, generates embeddings, and stores them in Qdrant.

Returns a spDocumentId for reference.

  1. HTTP Request Node 2: Procedure Submission

Accepts a JSON payload with:

{ "procedure": "Policy or procedure text", "description": "Brief context or objective", "spDocumentId": "ID of the uploaded document" }

Links the procedure to the previously uploaded document.

  1. Order of Operations

Step 1: Upload the document.

Step 2: Submit the procedure referencing the same spDocumentId.

Step 3: AI agent evaluates compliance and returns results.

Example Input & Output

Example Input: Document Upload (Webhook 1)

  • Request: Binary file upload (example_policy.pdf)

  • Response:

{ "spDocumentId": "12345" }

Example Input: Procedure Submission (Webhook 2)

{ "procedure": "All financial records must be retained for 7 years.", "description": "Retention policy compliance validation", "spDocumentId": "12345" }

Example Output: AI Compliance Validation

{ "compliance_summary": "The document includes a 7-year retention requirement for invoices and payroll records.", "non_compliance_summary": "No reference to retention of vendor contracts.", "citations": [ { "text": "Invoices will be stored for 7 years.", "page": 4 } ], "confidence": 87 }

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Audit Document Upload

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2

Block 2 - Procedure Submission

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2

Block 3 - Fetch Document (Microsoft Graph)

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 4 - Delete Old Document Vectors

Type / Role
@n8n/n8n-nodes-langchain.code - code
Config choices
Version 1

Block 5 - Extract PDF Text

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 6 - Generate Document Embeddings

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOllama - embeddingsOllama
Config choices
Version 1

Block 7 - Insert Vectors into Qdrant

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreQdrant - vectorStoreQdrant
Config choices
Version 1.3

Block 8 - Load Document Metadata

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1.1

Block 9 - Split Text into Chunks

Type / Role
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - textSplitterRecursiveCharacterTextSplitter
Config choices
Version 1

Block 10 - Format Procedure Payload

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - AI Compliance Validator

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2.1

Block 12 - Language Model (AI Agent)

Type / Role
@n8n/n8n-nodes-langchain.lmChatOllama - lmChatOllama
Config choices
Version 1

Block 13 - Retrieve Relevant Document Chunks

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreQdrant - vectorStoreQdrant
Config choices
Version 1.3

Block 14 - Generate Query Embeddings

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOllama - embeddingsOllama
Config choices
Version 1

Block 15 - Language Model (Structured Output)

Type / Role
@n8n/n8n-nodes-langchain.lmChatOllama - lmChatOllama
Config choices
Version 1

Block 16 - Parse AI Response

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.3

Block 17 - Return Compliance Report

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.4

Block 18 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Automated document compliance validation with AI and vector database
Complexity advanced
Nodes 22
Categories AI RAG, Multimodal AI
Author Thapani Sawaengsri
Published 20 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7662/7662.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automated document compliance validation with AI and vector database do?

Description This workflow automates compliance validation between a policy/procedure and a corresponding uploaded document. It leverages an AI agent to determine whether the content of the document...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your AI RAG, Multimodal AI use case.