Library / AI Agents & Assistants
AI Agents & Assistants
Investigate batch deviation root causes with GPT-4.1, QMS, and Slack
When an API call/webhook arrives, it runs an AI agent with OpenAI / ChatGPT using Postgres, Slack.
What it does
## AI Batch Deviation Root-Cause Investigator ### How it works This workflow receives a submitted batch deviation, prepares the investigation context, and uses an AI agent to investigate likely root causes using equipment, operator, environmental, and historical CAPA data. It logs the AI-generated root-cause analysis to Postgres, then branches based on confidence: low-confidence cases are routed for manual investigation, while sufficient-confidence cases go through QA review. If QA approves, the workflow updates the QMS deviation record, optionally creates a draft CAPA, and posts a final investigation summary to Slack. ### Setup steps - Configure the webhook URL and ensure the submitting system sends deviationId, batchId, product, and deviationDescription or compatible fields for the Set - Config node. - Add credentials for OpenAI Chat Model and configure the AI Agent prompt, model, and memory settings. - Configure the AI tool connections for equipment events, operator actions, environmental data, and historical CAPA vector search, including any required API keys or internal network access. - Set up Postgres credentials and confirm the RCA investigation logging table/schema matches the insert or update performed by the Postgres node. - Configure Slack credentials, target channels, and message templates for QA review, manual investigation notices, rejection notices, and final summaries. - Configure QMS API credentials and endpoints for updating deviation records and creating optional CAPA draft records. - Verify the Wait node resume behavior and QA approval payload format so the IF - QA Approved condition can evaluate decisions correctly. ### Customization Adjust the AI investigation prompt, confidence threshold, QA approval logic, CAPA recommendation criteria, Slack channels, and QMS endpoint mappings to match the organization’s deviation and CAPA process.
The steps
- When Deviation Submitted
- Set Deviation Configuration
- Query Equipment Events
- Query Operator Actions
- Query Environmental Data
- Search Historical CAPAs
- OpenAI GPT-4 Chat
- Buffer AI Memory
- Deviation Analysis Agent
- Parse Agent Output
- Log RCA Investigation
- If Hypothesis Confidence High
- Notify Manual Investigation
- Send QA Review Request
22 steps in total.
Similar automations
AI Agents & AssistantsInvestigate Sentry incidents with Google Gemini, Postgres, GitHub and Slack14 stepsAlerts & NotificationsDetect and investigate subscription revenue anomalies with Postgres and Claude34 stepsMonitoring, Ops & IncidentsInvestigate Alertmanager incidents with GPT-4.1, ClickUp, Slack, and PagerDuty14 stepsData Sync & ETLInvestigate fuel tank variances with Google Sheets, Gemini, and Slack20 steps