An anomaly on a machine opens a service ticket by itself.
You react to a failure once the machine has stopped, which is the most expensive possible moment. The audit checks whether you have enough history for detection, how often false alarms will fire, and when it pays back at your production volume.
AI Agent + human review
A hybrid AI workflow with human-in-the-loop gates is the right fit, automating routine anomaly detection while keeping expert judgement on exceptions.
The process is a strong candidate for a hybrid AI workflow that ingests sensor and log data, scores anomaly likelihood automatically, and routes routine cases to service tickets without human touch. Roughly a quarter of cases require expert judgement, and the compliance stakes around product safety and traceability mean a human gate on low-confidence detections is not optional but a design feature. The client's preferred stack of Python and a readable MES database is well matched to this approach: a Python-based ingestion and scoring pipeline can sit directly on the MES database and feed a lightweight ticketing layer. The result the client described, where people only look at exceptions, is exactly what a well-tuned hybrid delivers.
Python is the natural language for the data ingestion, feature engineering and anomaly-scoring pipeline, and the MES database connection removes the need for any additional middleware. The automation engineer's PLC background means the team already understands the machine data domain, which is the hardest part of building a reliable model.
Process Overview
Predictive Maintenance from Sensors and Logs is a plant operations process in which machines continuously produce sensor readings and log entries that are monitored for signs of emerging faults. At present, shift supervisors and maintenance technicians manually review data from the MES system, machine logs and sensor feeds, diagnose whether an anomaly represents a real fault or a false alarm, decide on priority, and raise a service ticket by hand. The process runs several times a week in bursts, totalling around 500 cases per year at roughly 45 minutes of manual effort each, and the detection almost always happens reactively, after a machine has already slowed or stopped.
The desired end state is a system that ingests sensor and log data continuously, scores each anomaly against historical patterns, and automatically opens and routes a service ticket for routine high-confidence cases without any human touch. Cases where the model is uncertain, where the fault pattern is non-standard, or where sensor data is noisy are flagged for review by a shift supervisor or technician, who confirms or dismisses the alert. Their decisions feed back into the model to sharpen future classifications. The compliance context is significant: product safety and traceability requirements mean that every automated decision must be logged in enough detail to support a recall investigation, so human oversight on uncertain cases is a regulatory and liability consideration, not just an operational preference.
The client team consists of a plant manager, two shift supervisors, and a maintenance technician. The automation engineer, who has a PLC background and is actively learning Python, will build and maintain the pipeline. The primary system is a legacy MES with a readable database, supplemented by machine logs, sensor feeds, PLC systems, email, and spreadsheets. The readable MES database and existing Python capability are the two most important assets for the build.
Path Scores
Routine anomaly detection is highly automatable given structured sensor and log data, but the 25% exception rate and product-safety compliance requirements demand a human gate on uncertain cases. A hybrid model delivers the client's stated goal of freeing people from the boring part while keeping expert oversight exactly where it matters.
An end-to-end AI workflow without human gates could handle the routine majority well, but the compliance and traceability requirements make fully autonomous ticket creation on uncertain cases a recall risk. It is viable only if confidence thresholds are set very conservatively, which effectively recreates a hybrid anyway.
An AI agent could orchestrate data collection, scoring and ticket creation end to end, but the safety-critical nature of the process and the variety of exception types mean full autonomy is premature without a substantial period of supervised operation first. The team's current Python capability would also need to grow significantly to build and maintain an agent reliably.
Rule-based threshold alerting on sensor data is a well-understood approach and the automation engineer could implement it in Python against the MES database. However, static rules struggle with the variety of fault patterns described and will generate the false alarms the client is already worried about; a statistical or ML scoring layer adds meaningful value over pure rules.
The team clearly needs upskilling to build and run the recommended solution, but education alone does not address the core problem of manual, fragmented detection. It is a necessary complement to the hybrid path, not a substitute for it.
RPA is suited to navigating fixed UI screens and copying structured data, not to analysing time-series sensor streams or scoring anomaly likelihood. It could automate the ticket-creation step at the end of the process but adds no value to the detection and classification steps that are the real bottleneck.
The current manual process reacts to failures only after machines have stopped, which the client explicitly identifies as the most expensive possible moment. Staying manual preserves all of that cost and risk and does nothing to address the knowledge concentration in two or three people's heads.
Process Dimensions
Eight dimensions drive the recommendation, scored 0–10 with a note on each.
Machine logs and sensor feeds are structured or semi-structured time-series data, which is well suited to ML-based anomaly scoring, though data quality and completeness from the legacy MES will need validation before modelling.
Standard fault patterns are well understood, but the variety of exception types and the fact that process knowledge sits in a few people's heads means rules are not fully explicit and will need to be extracted and encoded during the build phase.
Approximately 25% of cases are non-standard and require human judgement, which is high enough to make a fully automated path risky but low enough that automation still delivers substantial value on the remaining 75%.
The MES database is readable and the team has Python capability, giving a solid foundation, but the legacy MES and the mix of machines with and without sensors means integration will require careful scoping and some custom connectors.
500 runs per year at 45 minutes each totals 375 hours of manual effort annually, and the downstream cost of undetected failures (machine downtime, potential recalls) amplifies the ROI case well beyond the direct labour saving.
The machine fleet and fault taxonomy are relatively stable in manufacturing, but new machines or product lines will require model retraining and rule updates, so the solution must be designed for ongoing maintenance rather than set-and-forget.
Expert judgement is essential for the 25% of non-standard cases and for validating model confidence on safety-critical detections; the hybrid design preserves this judgement where it genuinely adds value.
Product safety and traceability requirements mean every automated decision must be logged with enough detail to support a recall investigation, making audit trail design a first-class requirement of the build.
ROI Estimate
£28,125
Current annual cost
70%
Estimated time saved
£19,688
Annual savings
15mo
Payback period
Current annual cost calculated as 500 runs x 45 min / 60 x GBP 45 per hour = GBP 28,125. A 70% automation rate is applied to the 75% of routine cases, with the remaining 25% of exception cases still requiring full human attention; this is a conservative estimate that excludes the larger but harder-to-quantify savings from earlier fault detection and avoided machine downtime.
Implementation Roadmap
Assess the quality, completeness and accessibility of MES database records, sensor feeds and machine logs. Identify which machines have usable history, map the existing fault taxonomy with the maintenance technician and shift supervisors, and define the minimum dataset needed to train an initial anomaly scorer. This milestone de-risks the entire build by confirming the data foundation before any model work begins.
Build a Python pipeline that reads from the MES database and available sensor feeds on a scheduled basis, cleans and normalises the time-series data, and writes it to a local data store. The automation engineer leads this with support from the consultant. Key dependency is confirmed database access credentials and a stable schema from the MES team.
Train an initial statistical or lightweight ML anomaly detection model on the historical data extracted in the previous milestone. Validate against known past failures with the maintenance technician acting as ground truth. Set conservative confidence thresholds so that uncertain cases always route to human review rather than auto-close.
Build the routing logic: high-confidence detections auto-generate service tickets, low-confidence detections go to a review queue visible to shift supervisors. Integrate ticket creation with whatever system the team currently uses (email or a simple ticketing tool). Ensure every automated decision is logged with the sensor values, model score and timestamp to satisfy traceability requirements.
Run the system in parallel with the existing manual process for four to six weeks. Supervisors review all automated decisions and flag false positives and missed detections. Use this feedback to retune confidence thresholds and, if needed, retrain the model on newly labelled cases. This phase is the primary quality gate before the manual process is retired.
Document the pipeline, model retraining procedure and escalation rules. Train the automation engineer to own the system day-to-day and define a quarterly review cadence where the plant manager and supervisors assess false-alarm rates and model drift. Establish a clear protocol for adding new machines or fault types to the model.
Risks & Considerations
The biggest risk is data quality. If the MES history is incomplete or the sensor coverage is patchy across the machine fleet, the anomaly model will produce too many false alarms to be trusted, and the team will revert to manual checking within weeks of go-live. A rigorous data audit in the first milestone is the primary mitigation. Model drift is the second risk: as machines age or new products are introduced, fault signatures change and a model trained on old data will miss new patterns. The quarterly review cadence and a clear retraining protocol are essential to prevent silent degradation.
On the compliance side, the audit trail design must be treated as a non-negotiable requirement from day one, not a retrofit. If a defect reaches a customer and triggers a recall, the business must be able to show exactly what the system detected, what confidence score it assigned, and who reviewed or approved the automated decision. Any gap in that log is a liability. Human oversight on low-confidence detections is therefore not a temporary crutch but a permanent design feature of this system.
In partnership with AIRIES, the Swiss AI learning platform. These levels fit your result.
-
3
Corporate Applied Intelligence & AutomationTurn your own tasks into AI workflows, build reports and dashboards, set up a personal AI assistant.
-
5
AI for Strategy & OperationsOptimise operations, forecast, and automate KPIs and executive reporting.
Level 3 gives the automation engineer the practical skills to turn the sensor and log data pipeline into a structured AI workflow and build the review dashboard the supervisors will use daily. Level 5 equips the plant manager and operations leads to define the KPIs, monitor model performance over time, and make data-driven decisions about when to retrain or escalate. Together these two levels cover both the build and the ongoing governance of the recommended hybrid solution.
- Building AI-assisted data workflows in Python
- Anomaly detection and time-series analysis
- KPI automation and operational dashboards
- Designing human-in-the-loop escalation rules
Automation engineer who will build and maintain the pipeline, plus the plant manager and shift supervisors who will own the process outcomes.
Architecture Overview
Hover to zoom · click for fullscreen
Why This Approach
The recommended path is a Hybrid AI workflow with human-in-the-loop gates, and the reasoning comes directly from the shape of this specific process rather than from any general preference for AI solutions. Around 75% of cases follow recognisable patterns that a well-trained anomaly scoring model can classify with high confidence, which makes those cases strong candidates for full automation. The remaining 25% involve non-standard fault signatures, noisy sensor data, or insufficient historical precedent, and on those cases the combination of product-safety compliance requirements and real recall risk means autonomous action is not acceptable. The hybrid design treats the human review queue not as a fallback for when the system fails but as a permanent, intentional feature of the architecture. That distinction matters for how you build and communicate the system internally.
The client's preferred tech stack, Python and the readable MES database, is genuinely well matched to this approach, and it is worth being explicit about why. A Python-based ingestion and scoring pipeline can connect directly to the MES database without any additional middleware layer, which removes a significant source of integration complexity and ongoing maintenance overhead. The automation engineer's PLC background is an underrated asset here: understanding how machines produce data and what normal operating envelopes look like is often the hardest knowledge to acquire when building an anomaly model, and this team already has it. The recommended build is therefore feasible with the existing team, with targeted upskilling rather than external specialist hiring.
Comparing the Hybrid path to its nearest alternatives makes the case clearer. A fully automated AI Workflow scored six out of ten, and it is viable only if confidence thresholds are set so conservatively that uncertain cases always route to human review anyway, which effectively recreates a hybrid under a different name. There is no meaningful benefit to calling it fully automated if the compliance requirements force you to retain human gates regardless. An AI Agent scored five, and the honest assessment is that full autonomy on a safety-critical process is premature before the team has accumulated a substantial period of supervised operation and before the automation engineer has grown significantly beyond current Python capability. Agents are powerful but they require robust observability and error-handling discipline that takes time to develop. Traditional Code also scored five. Rule-based threshold alerting on the MES database is something the automation engineer could implement today, and for some machines it may be exactly the right starting point. The limitation is that static rules will generate the false alarms the client is already frustrated by, because real fault signatures in a mixed machine fleet are rarely clean enough for simple thresholds to distinguish signal from noise. A statistical or lightweight ML scoring layer adds real value over pure rules, and the data the team already holds is sufficient to build one.
There are honest tradeoffs to name. The hybrid path is more complex to build and maintain than a purely rule-based system. The model requires retraining as machines age and fault taxonomies evolve, and that ongoing maintenance commitment needs to be owned by someone, ideally the automation engineer with a defined quarterly review cadence involving the plant manager. The audit trail design, covering sensor values, model scores, timestamps, and reviewer decisions, must be treated as a first-class requirement from the start, not something retrofitted after go-live. And the entire system's reliability depends on the quality and completeness of the MES history and sensor coverage, which is why the data audit in the first implementation milestone is the most important single step in the project. If the data foundation is weak, the model will produce too many false positives and the team will stop trusting it quickly. Confirming data quality before writing a single line of model code is not caution for its own sake; it is the primary risk mitigation for the whole programme.
Comparing the Top Approaches
The top contender is the Hybrid path, and the case for it over a Fully Automated AI Workflow comes down to one concrete constraint: product safety compliance. A fully automated AI Workflow could handle the straightforward majority of detections well, but the moment it auto-closes a low-confidence case that turns out to be a real fault, the business is exposed, because there is no human sign-off in the log and no clear accountability if that fault reaches a customer. Setting the confidence threshold high enough to avoid that outcome effectively recreates a human review queue anyway, so you end up with a hybrid in practice without the intentional design that makes it reliable and auditable.
The AI Agent path scores lower not because the technology is wrong for this domain, but because full autonomy is premature here. An agent that can orchestrate data collection, scoring, ticket creation and escalation end-to-end is a reasonable long-term direction, but it requires a level of model maturity and team capability that does not exist yet. The automation engineer is still building Python skills, the fault taxonomy is only partially explicit, and the machine fleet is mixed in terms of sensor coverage. Running an agent over that foundation without a supervised period first is how you get a system nobody trusts within two months of launch.
Traditional Code, meaning static threshold rules written in Python against the MES database, is worth addressing because it is the path the team might instinctively reach for. Rule-based alerting is understandable, cheap to build, and the automation engineer could have something working quickly. The problem is that static rules struggle with the variety of fault patterns the team themselves described, and they are the primary source of the false alarms the plant manager is already frustrated with. Adding a statistical or lightweight ML scoring layer over the same data infrastructure delivers meaningfully better precision for a modest increase in build complexity, and that difference compounds over 500 runs a year.
How to Build It
The build starts with a data audit before a single line of model code is written. The automation engineer, working with the maintenance technician, maps every data source: the MES database schema, the machine log formats, and which machines in the fleet actually have usable sensor feeds. The output is a clear picture of which historical fault records are complete enough to train on and which machines will need manual observation to fill the gaps. This milestone typically takes two to three weeks and it is the most important one, because a model trained on incomplete history will produce the false alarm rates that kill trust in the system on day one. Tools here are straightforward: Python with pandas and SQLAlchemy to query the MES database directly, and whatever file-based access the machine logs expose.
Once the data foundation is confirmed, the automation engineer builds a scheduled ingestion pipeline in Python that reads from the MES database and available sensor feeds, normalises the time-series readings into a consistent format, and writes them to a local store, something as simple as a PostgreSQL instance or even structured flat files at this stage. The pipeline runs on a cron schedule or a lightweight orchestrator like Prefect or Apache Airflow, depending on how much operational overhead the team is comfortable managing. The key design requirement is idempotency: the pipeline must handle gaps, retries and duplicate readings without corrupting the history it is building, because that history becomes the training data for the model.
The anomaly scoring layer sits on top of the ingestion pipeline and this is where the intelligence lives. For a first version, a statistical approach using isolation forest or a simple LSTM-based sequence model trained in scikit-learn or PyTorch is appropriate. The maintenance technician acts as ground truth during validation, reviewing a sample of past cases and labelling them as true faults or noise. Confidence thresholds are set conservatively: anything below a defined score goes to a human review queue rather than auto-generating a ticket. High-confidence detections create service tickets automatically via the existing system, whether that is a shared email inbox, a tool like Jira Service Management, or a direct write back to the MES if it supports it. Every automated decision, the sensor values that triggered it, the model score, and the timestamp, is written to an audit log in a format that can be queried during a recall investigation.
The supervised pilot phase is where the system earns the team's trust. For four to six weeks the pipeline runs in parallel with the existing manual process, and shift supervisors review every automated decision alongside their normal checks. False positives and missed detections are flagged, labelled, and fed back into the model as new training data. This phase is also when confidence thresholds get tuned to the actual noise characteristics of this specific machine fleet, something no amount of upfront modelling can substitute for. At the end of the pilot, the plant manager reviews the false alarm rate and detection rate against the targets set at the start, and makes the call to retire the manual process. Ongoing governance is a quarterly review where the team checks for model drift, adds any new fault types encountered since the last review, and confirms the audit log is complete and queryable.
Risks in Detail
The most serious risk is data quality, and it is worth being direct about what that means in practice. If the MES history has significant gaps, if sensor coverage is patchy across the machine fleet, or if past fault records were logged inconsistently by different shift supervisors, the anomaly model will not have enough clean signal to distinguish real faults from noise. The result is a high false alarm rate, supervisors start ignoring the review queue, and within a few weeks the team is back to manual checking with an expensive pipeline running in the background. The data audit in the first milestone exists specifically to catch this before it happens, but if the audit reveals the data foundation is too weak, the honest answer is that the model-based scoring layer needs to wait while data collection practices are improved, and the team runs on rule-based thresholds in the interim. That is a less exciting outcome but a more reliable one.
Model drift is the second risk and it is slower and quieter than a data quality failure, which makes it more dangerous. As machines age, as new products introduce different operating cycles, or as the fleet expands, the fault signatures the model was trained on gradually stop representing what is actually happening on the floor. A model that was 85% accurate at launch can drift to 60% over eighteen months without anyone noticing, because the failures it misses look like the normal variation it was trained to ignore. The quarterly review cadence and a clear retraining protocol are the primary mitigations, but they only work if the plant manager treats them as a fixed operational commitment rather than an optional improvement task. On the compliance side, the audit trail is not a feature that can be added later. If a defect reaches a customer and a recall is triggered, investigators will want to see exactly what the system detected, what confidence score it assigned, what action was taken, and who reviewed it. Any gap in that log is a liability. Human oversight on low-confidence detections must be treated as a permanent design constraint, not a temporary measure until the model gets better.
Claude Code Starter
A scaffolded project ready to open in Claude Code. Unzip, open the folder, and Claude starts building immediately.
Claude Code Starter (.zip)
Your own assessment includes a ready-to-use project scaffold: CLAUDE.md, pyproject.toml, src/agent.py and .env.example. Open the folder in Claude Code and it starts building.