This workflow directly attacks two primary sources of waste and brand risk: product giveaway from underfills and catastrophic recalls from contaminants. It automates the manual or semi-automated inspection bottleneck by fusing data from high-speed vision cameras and level sensors. The operational upside comes from eliminating underfill waste, preventing entire batches from being quarantined, and creating an auditable, real-time quality record for regulatory compliance (e.g., FDA, SQF). Implementation requires integrating edge inference with line control systems like PLCs and SCADA to trigger immediate reject actions.
Automation
Agentic Workflow for Food and Beverage Fill-Level and Contaminant Inspection

Implementing Dual-Threat Fill-Level and Contaminant Inspection Architecture
A custom agentic workflow that simultaneously verifies fill height and scans for foreign objects on high-speed food and beverage lines, automating a critical quality and compliance bottleneck.
Architecturally, the solution deploys specialized vision models for fill verification and foreign object detection (FOD) on edge hardware, coordinated by a central agent that applies business rules—like confidence thresholds and batch history. Critical controls include human-in-the-loop review queues for ambiguous cases, automated Non-Conformance Report (NCR) generation in the Quality Management System (QMS), and integration with production data in SAP or Oracle for real-time yield dashboards. The build must account for variable lighting, container types, and high-speed rejection latency to be production-viable.
Business Impact: Where the Savings and Protection Come From
A dual-purpose agentic workflow that simultaneously prevents revenue loss from underfills and protects brand reputation by catching contaminants, delivering direct ROI through material savings and risk avoidance.
Eliminate Product Giveaway and Revenue Leakage
Underfilled containers represent pure profit loss—product given away without revenue. This workflow uses high-speed vision and level sensors to inspect every unit on the line, automatically rejecting underfills. For a line running 1,000 bottles per minute, even a 0.5% underfill rate can mean thousands of dollars in lost product daily. The system integrates directly with filler controls for real-time feedback, preventing chronic drift.
Prevent Catastrophic Recall and Brand Damage
A single contaminant—glass, metal, plastic—in a consumer product can trigger a full-scale recall, costing millions in direct expenses and incalculable brand damage. This workflow deploys X-ray or hyperspectral imaging agents that analyze every container, autonomously triggering a hard reject for any anomaly. The architecture includes immutable audit logs and automatic non-conformance reporting to the QMS (e.g., SAP QM), creating a defensible food safety record.
Reduce Manual Inspection Labor and Human Error
Manual sampling for fill level and visual inspection for contaminants is slow, inconsistent, and prone to fatigue. Automating 100% inspection with AI agents eliminates this variable cost and bottleneck. The workflow reallocates skilled operators from repetitive viewing tasks to exception handling and process oversight, improving job satisfaction and operational throughput without adding headcount.
Accelerate Line Speed and Overall Equipment Effectiveness (OEE)
Manual inspection limits maximum line speed. An automated, agentic inspection system operates at full line velocity, removing a key constraint on throughput. By integrating directly with the Manufacturing Execution System (MES), the workflow provides real-time yield (FPY) and OEE calculations, enabling dynamic adjustments to optimize production efficiency and identify chronic slowdowns or defect sources.
Minimize False Rejects and Product Waste
Overly sensitive inspection systems waste good product. This workflow uses a multi-agent architecture where a primary detection agent passes uncertain cases to a secondary validation agent with different model weights or logic. This reduces false positives by 40-60% compared to single-model systems. Rejected items are automatically routed for verification, ensuring only true defects are scrapped, protecting yield.
Enable Closed-Loop Process Control and Traceability
The workflow doesn't just detect—it acts and learns. Fill-level trends are fed back to the filler controller for automatic adjustment. Contaminant data is tagged with time, batch, and supplier information, enabling precise root-cause analysis. Every action is logged against the product serial number (via integrated OCR), creating a complete digital twin for each unit that supports granular recalls and supplier quality scoring.
Implementing Multi-Agent Edge Orchestration for Fill-Level and Contaminant Inspection
A custom automation architecture that simultaneously verifies fill height and detects foreign objects on high-speed packaging lines, directly reducing product giveaway and protecting brand safety.
This workflow automates a critical dual-inspection bottleneck where manual checks are too slow and single-purpose systems create blind spots. It eliminates underfill waste (giveaway) and prevents contaminated products from shipping, which directly protects revenue and mitigates catastrophic recall risk. The architecture fuses high-speed vision sensors with level detectors, requiring sub-second orchestration to inspect, decide, and act before the product leaves the station, tying each action to a serialized unit record for full traceability.
Implementation deploys lightweight agents on edge hardware (e.g., NVIDIA Jetson) co-located with the line, using a framework like LangGraph for state management. The orchestrator agent handles sensor fusion, routes image frames to specialized vision models, and executes rejection logic via PLC integration. Critical controls include human review queues for low-confidence results, automated model drift monitoring, and bidirectional sync with SAP or Oracle for real-time scrap cost attribution and production order updates.
Workflow Components: The Building Blocks of a Custom Build
A dual-purpose, high-speed automation workflow that simultaneously verifies fill height to prevent underfills and inspects for foreign contaminants, directly protecting brand reputation and reducing product giveaway.
High-Speed Sensor Fusion & Edge Inference
The workflow ingests synchronized data streams from line-scan cameras, level sensors, and X-ray/spectral imagers at production line speeds. Edge-deployed vision models (e.g., YOLO, custom CNNs) run inference locally to meet sub-second latency requirements for fill-level measurement and contaminant detection, ensuring no bottleneck to line throughput.
Agentic Decision & Rejection Orchestration
A primary orchestration agent (built with LangGraph or similar) receives inference results, applies business rules (e.g., fill tolerance ±2mm), and renders a unified pass/fail decision. On a fail, it triggers PLC commands via OPC-UA/MQTT to activate a reject arm, diverter, or stop-the-line signal, with built-in safety interlocks to prevent mechanical collisions.
Closed-Loop Quality Management System (QMS) Integration
Every inspection event—pass or fail—is logged with a timestamp, image snapshot, and serial/batch number. Failed units automatically generate Non-Conformance Reports (NCRs) in integrated QMS platforms like SAP QM or ETQ Reliance. This creates a defensible audit trail for FDA, USDA, or BRCGS compliance and triggers root-cause analysis workflows.
Real-Time Yield Analytics & Dashboarding
A dedicated analytics agent continuously aggregates inspection results, calculating real-time First-Pass Yield (FPY) and overall equipment effectiveness (OEE). These metrics are pushed via API to live Grafana or Power BI dashboards visible to line supervisors and plant managers, enabling immediate intervention on drift.
Continuous Learning & Model Retraining Pipeline
To adapt to new packaging or contaminant types, a retraining pipeline agent manages a human-in-the-loop workflow. Ambiguous or novel defects are routed to a review queue for QA technicians to label. Approved labels trigger automated model retraining on a cloud GPU cluster, with validated models pushed back to the edge via a secure CI/CD pipeline.
Exception Handling & Human Escalation Layer
The system includes defined escalation paths for low-confidence decisions, system errors, or consecutive rejects. Alerts are routed via Slack, Teams, or PagerDuty to maintenance and quality engineers. A web-based review portal allows supervisors to override decisions, annotate images, and provide feedback that feeds the continuous learning loop.
Implementing Agentic Fill-Level and Contaminant Inspection for Food & Beverage
This blueprint details a phased implementation for a custom, dual-purpose agentic workflow that simultaneously automates fill-level verification and contaminant detection on high-speed packaging lines, delivering measurable ROI through reduced giveaway and brand protection.
Phase 1 establishes the core detection and rejection loop. High-speed line-scan cameras and level sensors feed real-time data to an edge-based orchestrator (e.g., LangGraph) running specialized vision models. The orchestrator fuses these signals, makes a unified pass/fail decision, and triggers PLC-controlled reject arms within milliseconds. This initial deployment targets a single line, focusing on integrating with the line control system (e.g., Rockwell, Siemens) and building the foundational data pipeline to a time-series database for immediate scrap tracking and yield calculation.
Phase 2 introduces closed-loop controls and advanced governance. The workflow is scaled across multiple lines, with the orchestrator now feeding defect imagery and root-cause tags (e.g., 'filler-valve-3 underfill') directly into the QMS (e.g., SAP QM) to auto-generate Non-Conformance Reports. Predictive agents analyze trends to recommend filler calibration or filter maintenance before tolerance breaches. Phase 3 focuses on continuous learning, where a retraining pipeline uses new defect data from the line, validated via a human-in-the-loop interface, to periodically update models, ensuring the system adapts to new packaging or contaminant types without performance drift.
ROI and Operating Economics
Comparison of operational and financial metrics for a food and beverage fill-level and contaminant inspection line before and after implementing a custom agentic workflow.
| Metric | Manual / Legacy System | Custom Agentic Workflow |
|---|---|---|
Inspection Cycle Time per Batch | 2.5 hours (manual sampling) | Continuous real-time (< 1 sec latency) |
Defect Escape Rate to Packaging | ~2.5% (based on sampling) | < 0.1% (100% inline inspection) |
Annual Scrap & Giveaway Cost | $850,000 (underfills, false rejects) | $120,000 (precise, validated rejects) |
Full-Time Equivalent (FTE) Inspection Labor | 8 FTEs per line (2 shifts) | 1.5 FTEs (exception monitoring & oversight) |
Mean Time to Detect (MTTD) Contaminant | Up to 4 hours (next lab test batch) | < 60 seconds (inline X-ray/vision fusion) |
Audit Trail & Reporting Compliance Effort | 40 person-hours/week (manual logs) | Automated, real-time (QMS/ERP sync) |
Line Speed / Throughput Impact | Capped at 85% due to manual checks | Optimized to 98% (dynamic, no bottleneck) |
Recall Risk Exposure (Annualized Cost) | $2.1M (modeled liability & brand impact) | < $250,000 (proactive containment & traceability) |
Governance, Controls, and Phased Rollout for Fill-Level and Contaminant Inspection
A production-grade inspection workflow requires robust governance, explicit controls, and a phased rollout to mitigate operational risk while delivering measurable yield and brand-protection benefits.
Effective governance begins with a clear separation of duties between the autonomous agents and human oversight. The workflow must define which defect types (e.g., critical contaminants) trigger immediate, automated rejection versus those requiring human review. This is codified in a centralized rule engine, often integrated with a Quality Management System (QMS) like SAP QM or ETQ Reliance, which also manages the audit trail for all automated decisions, including images, confidence scores, and the rationale for any overrides by line supervisors.
A phased rollout is critical for managing change and validating performance. Phase 1 deploys the system in 'monitor-only' mode, logging all detections without physical action to calibrate thresholds and reduce false positives. Phase 2 enables automated rejection for high-confidence, non-critical underfills, with all contaminant detections routed to human review. The final phase activates full autonomous rejection for all defined critical defects, following a successful audit of the control logic and exception-handling procedures. Each phase includes defined KPIs for false-positive rates, throughput impact, and scrap reduction to validate ROI before proceeding.
Frequently Asked Questions
Building a dual-purpose fill-level and contaminant inspection workflow involves more than just model accuracy. These answers address the practical controls, integration hurdles, and rollout risks that technical leaders must manage for a successful deployment.
A production-grade workflow embeds data validation and augmentation at the edge. Before inference, a pre-processing agent assesses image quality (focus, contrast, glare) and can trigger automatic lighting adjustments or request a manual audit if inputs are unreliable. The system is trained on synthetically augmented data representing worst-case line conditions (e.g., condensation, reflective surfaces). During operation, low-confidence detections are routed to a human review queue, and these edge cases are automatically captured to retrain models, creating a continuous improvement loop that adapts to the real factory environment.
Stakeholder Map: Who is Involved in Success
A successful build requires tight coordination between plant operations, quality, engineering, and IT to ensure the system meets production speed, safety, and integration requirements.
Plant Operations & Line Managers
Own the production schedule and line uptime. They define the operational constraints: required throughput (e.g., 1200 bottles/minute), acceptable false-positive rates (<0.1%), and physical integration points for reject arms or diverters. Their sign-off depends on the workflow's reliability under real-world line conditions and its impact on Overall Equipment Effectiveness (OEE).
Quality Assurance & Food Safety
Set the pass/fail criteria for fill levels (e.g., ±1mm tolerance) and contaminant detection (e.g., metal fragments ≥0.3mm). They mandate the audit trail, requiring each reject decision to be logged with an image, timestamp, and reason code for regulatory compliance (FDA, SQF). Their involvement ensures the workflow meets HACCP and brand protection standards.
Automation & Controls Engineers
Design the physical integration, connecting vision system triggers to PLCs (e.g., Siemens, Allen-Bradley) that control reject mechanisms. They implement safety interlocks, handle exception routing (e.g., divert to quarantine lane), and ensure the low-latency data flow between edge inference devices and line control systems doesn't introduce jitter.
IT & Data Engineering
Architect the data pipeline from edge cameras to cloud or on-prem storage, ensuring images and inspection results are ingested into a data lake (e.g., AWS S3, Azure Blob). They build the APIs to push aggregated yield and defect data to MES (Manufacturing Execution Systems) and ERP (e.g., SAP) for real-time dashboards and cost-of-quality reporting.
Machine Vision & AI Specialists
Develop and deploy the dual-model architecture: one for fill-level verification (using structured light or level sensing fusion) and another for contaminant detection (using spectral or X-ray imaging). They manage the model lifecycle—including continuous learning pipelines to adapt to new packaging or contaminant types—and monitor for performance drift.
Procurement & Finance
Validate the ROI model, weighing capital expenditure for vision hardware and integration services against the hard savings from reduced product giveaway (underfills) and avoided recall costs. They govern the procurement process for cameras, sensors, and computing hardware, and track the project against key metrics like scrap reduction and labor displacement.
Comparison: Manual, Rules-Based, vs. Agentic Workflow for Fill-Level and Contaminant Inspection
This table compares the operational and economic tradeoffs between traditional inspection methods and a custom agentic workflow that fuses vision, level sensing, and autonomous decision logic to simultaneously verify fill height and detect foreign materials.
| Metric | Manual Visual Inspection | Rules-Based Vision System | Custom Agentic Workflow |
|---|---|---|---|
Inspection Cycle Time Per Unit | 5-7 seconds | 1-2 seconds | ~300 milliseconds |
False Reject Rate (Giveaway Cost) | Low (<1%) | High (5-15%) | Optimized (1-3%) |
Critical Contaminant Detection Rate | ~85% (variable by operator) |
|
|
Mean Time to Isolate a Contaminated Batch | 15-45 minutes | 2-5 minutes | <60 seconds |
Audit Trail & Reporting Coverage | Paper logs, photos | Structured logs, images | Granular traceability per unit to MES/QMS |
Annual Operational Cost (Labor, Scrap, Giveaway) | $450,000 | $220,000 | $95,000 |
Ability to Handle New SKU/Container Without Re-Programming | High (human adaptable) | Low (requires engineer) | Autonomous (agent retrieves CAD spec) |
System Uptime / Availability | ~85% (shifts, breaks) |
|
|
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Compliance and Validation Considerations
Implementing an agentic vision workflow for fill-level and contaminant inspection requires a production-grade architecture that balances high-speed automation with stringent regulatory and operational controls. This section addresses the practical concerns of technical buyers building these systems.
Data quality is foundational. Implement a pipeline that continuously logs edge inference results (images, predictions, sensor readings) to a central data lake. Use a human-in-the-loop (HITL) review queue for low-confidence detections and novel anomalies to create a labeled validation set. This closed-loop system feeds a continuous retraining pipeline, ensuring models adapt to new packaging, lighting changes, or emerging contaminant types without degrading performance. Data lineage and versioning for all training sets are mandatory for auditability.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us