Contract extraction, risk analysis & compliance automation with GPT-4.1 Mini
Ready for 3.0What this workflow does
This AI workflow has 23 nodes and runs on a schedule (every day at 02:00) (plus 2 other triggers). Along the way it connects Gmail, Embeddings OpenAI, OpenAI Chat Model and Postgres and 1 more.
How it runs
Trigger: On a schedule (every day at 02:00) (plus 2 other triggers).
- Workflow Configuration (Edit Fields (Set)): sets 8 fields: repositoryApiUrl, dashboardApiUrl, clmSystemUrl…
- Merge: merges the data from its input branches
- Fetch Contracts from Repository (HTTP Request): calls an HTTP API
- Extract Contract Content (Extract from File): extracts data from a file (pdf)
- Vector Store - Contract Clauses (Simple Vector Store): stores documents in the Simple vector store, with embeddings: OpenAI Embeddings; document loader: Document Loader - Contract Processing
- AI Agent: runs an AI agent, with model: OpenAI Chat Model; output parser: Structured Parser - Compliance Results
- Calculate Risk Score (Code): runs custom JavaScript code
- Store Compliance Results (Postgres): uses Postgres
- Route by Risk Level (Switch): routes items into 3 branches
- Alert - High Risk Contracts (Slack): uses Slack
…plus 5 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
- Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (Gmail - Contract Emails).
Nodes used (18)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Edit Fields (Set)
n8n-nodes-base.set - Webhook
n8n-nodes-base.webhook - Gmail Trigger
n8n-nodes-base.gmailTrigger - HTTP Request
n8n-nodes-base.httpRequest - Merge
n8n-nodes-base.merge - Extract from File
n8n-nodes-base.extractFromFile - Recursive Character Text Splitter
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi - Simple Vector Store
@n8n/n8n-nodes-langchain.vectorStoreInMemory - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - AI Agent
@n8n/n8n-nodes-langchain.agent - Code
n8n-nodes-base.code - Postgres
n8n-nodes-base.postgres - Switch
n8n-nodes-base.switch - Slack
n8n-nodes-base.slack
From the author
How It Works Scheduled triggers initiate automated contract reviews. The system fetches documents from cloud storage and email, then uses AI to extract key terms, obligations, and compliance requirements. Multi-model parsing identifies gaps, inconsistencies,…