Investigate batch deviation root causes with GPT-4.1, QMS, and Slack
Needs changesWhat this workflow does
This AI workflow has 22 nodes and runs when an HTTP POST request hits its webhook URL. Along the way it connects HTTP Request, Vector Store Question Answer, OpenAI Chat Model and Postgres and 1 more.
How it runs
Trigger: When an HTTP POST request hits its webhook URL.
- Set Deviation Configuration (Edit Fields (Set)): sets 8 fields: deviationId, batchId, product…
- Deviation Analysis Agent (AI Agent): runs an AI agent, with model: OpenAI GPT-4 Chat; 4 tools (Query Equipment Events, Query Operator Actions, Search Historical CAPAs, Query Environmental Data); memory: Buffer AI Memory
- Parse Agent Output (Edit Fields (Set)): sets 1 field: parsedOutput
- Log RCA Investigation (Postgres): uses Postgres
- If: checks a condition and branches into true / false
- Send QA Review Request (Slack): uses Slack
- Notify Manual Investigation (Slack): uses Slack
- Wait: pauses before continuing
- Respond Investigation Logged (Respond to Webhook): sends the response back to the webhook caller
- If: checks a condition and branches into true / false
…plus 5 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
2 things in this workflow are removed in n8n 3.0. Fix them before you upgrade:
- HTTP Request Tool (legacy) in Query Equipment Events, Query Operator Actions, Query Environmental Data: replace with HTTP Request node connected to the AI Agent's Tool input.
- AI Agent v1 (old agent modes) in Deviation Analysis Agent (v1.6): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
| Removed in 3.0 | Replace with |
|---|---|
| HTTP Request Tool (legacy) Query Equipment Events, Query Operator Actions, Query Environmental Data | HTTP Request node connected to the AI Agent's Tool input |
| AI Agent v1 (old agent modes) Deviation Analysis Agent (v1.6) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (13)
- Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - HTTP Request Tool
@n8n/n8n-nodes-langchain.toolHttpRequest - Vector Store Question Answer Tool
@n8n/n8n-nodes-langchain.toolVectorStore - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow - AI Agent
@n8n/n8n-nodes-langchain.agent - Postgres
n8n-nodes-base.postgres - If
n8n-nodes-base.if - Slack
n8n-nodes-base.slack - Wait
n8n-nodes-base.wait - HTTP Request
n8n-nodes-base.httpRequest - Respond to Webhook
n8n-nodes-base.respondToWebhook
From the author
Quick overview This workflow receives batch deviation submissions via webhook, uses OpenAI with tool-calling and a vector store RAG search to investigate likely root causes from MES/eBR/EMS data, logs results to Postgres, and routes higher-confidence findings…