Table of Contents
The ERP plans and accounts: orders, materials, stock and costs, over months, weeks and days. The MES executes: it dispatches orders to work centres and records what was actually made, consumed and scrapped, over shifts, hours and minutes. AI sits beside both. It reads their data, predicts, explains and proposes actions that people confirm in the system that owns them.
Key takeaways
- ISA-95 places ERP at Level 4, "Business planning and logistics", and MES at Level 3, "Manufacturing operations management", and deals mainly with the interface between the two (ISA).
- The handover is a loop: the ERP releases orders and master data to the MES, and the MES reports starts, good and scrap quantities, material consumption, time and order end back (Microsoft Learn).
- Joint guidance led by CISA says predictive ML is typically used in the operational Levels 0 to 3, and LLMs at Levels 4 and 5 (CISA et al., 2025).
- AI should not become a third system of record. Its outputs are predictions and proposals; transactions stay in the MES and ERP.
- Start read-only. An LLM agent operating a simulated MES reached 80% execution accuracy on 55 requests (Yuan et al., 2025).
What does an ERP do in a plant?
The ERP runs the business side of production. SAP describes S/4HANA as the core ERP that manages production-relevant processes such as procurement, production planning and inventory management, and as the place where master data is created and maintained (SAP Learning).
In practice, that means materials, bills of materials, routings, sales and purchase orders, production orders, stock and its value, costs and the general ledger. The OPC Foundation's summary of ISA-95 says ERP logistics systems automate Level 4, which "typically operates on time frames of months, weeks, and days" (OPC Foundation, OPC 10030).
What does an MES do?
The MES runs production as it happens. In the same ISA-95 summary, Level 3 covers detailed scheduling, work dispatching and work or product tracking, together with maintenance, quality assurance, laboratory and inventory movement functions. Collectively these are called Manufacturing Operations Management (MOM), and Level 3 "typically operates on time frames of days, shifts, hours, minutes, and seconds" (OPC Foundation, OPC 10030).
The same summary places batch control systems that execute recipes, data historians and recipe management at this level too. An MES is therefore one Level 3 system among several, not the whole layer. NIST describes MOM as applications that control plant-level operations (NIST IR 8107).
Where do the ERP and MES hand over?
At the production order. Microsoft's documentation for connecting Dynamics 365 Supply Chain Management to a third-party MES lists the processes that cross the boundary (Microsoft Learn):
- The ERP releases a production order and publishes a business event; the MES fetches the related reference data, such as product, bill of materials and route.
- The MES reports that the order has started.
- The MES reports good and scrapped quantities.
- The MES reports material consumption, so stock records stay current for planning and sales.
- The MES reports the time used per operation.
- The MES reports that the order has ended.
SAP describes the same loop with its own MES, SAP Digital Manufacturing: production and planned orders go down to "trigger production execution", and operation confirmations "with yield, scrap, and time efforts" come back (SAP Learning).
The format of these exchanges has a standard too. B2MML is "an XML implementation of the ANSI/ISA-95" family of standards, published by MESA (MESA International), and NIST describes it as linking ERP and supply chain systems with manufacturing systems such as MES (NIST IR 8107).
Which system owns which data?
Every data object should have one owner. Others may read it or hold a copy, but only the owner changes it.
| Data | Usual owner | Direction | What AI does with it |
|---|---|---|---|
| Material master, bill of materials, routing | ERP | ERP to MES | Reads it to interpret orders and consumption |
| Production and planned orders | ERP | ERP to MES on release | Reads status and dates; may propose a new date |
| Order start, good and scrap quantities, consumption, operation time, order end | MES | MES to ERP | Compares plan and actual; explains gaps |
| Lot and serial numbers produced | MES | Reported to ERP with the finished quantity | Links quality results to process conditions |
| Process values over time | Historian | Read by MES and analytics | Trains predictive models |
| Predictions, scores, recommendations | AI system | Shown in MES, ERP or an assistant | Stores them with the model version and inputs |
The lot and serial row follows Microsoft's report-as-finished message, which carries batch and serial numbers to the ERP (Microsoft Learn). Ownership varies by site; the point is to write it down before any AI project reads the data.
Do you need an MES if your ERP has a shop floor module?
Not always. Microsoft notes that some manufacturers control machines, equipment and personnel with the native functions of Dynamics 365, while others, "especially those that have advanced manufacturing requirements", use a third-party MES, for example one tailored to their industry (Microsoft Learn). Odoo's Shop Floor module, a companion to its Manufacturing app, lets operators track time on work orders, register lot or serial numbers, scrap components and close orders (Odoo documentation).
Three questions decide it:
- Traceability. Do customers or regulators require full lot genealogy from raw material to finished product?
- In-process quality. Are measurements and checks taken during production, or only at the end?
- Machine data. Must counts, states and downtime be collected automatically from equipment, rather than typed in?
If your plant has no dedicated MES and shop floor records live in spreadsheets or on paper, that matters for AI: when consumption and scrap are entered by hand once per shift, no model can be more precise than that entry.
Where does AI fit between MES and ERP?
AI is a third function, not a third layer. It reads from the systems on both sides, predicts or explains, and hands a proposal to a person. The CISA-led guidance gives the split by level (CISA et al., 2025):
| Level | Systems | AI uses listed by CISA | Example at the MES and ERP boundary |
|---|---|---|---|
| 3: Site-wide supervisory | MES, historians | Predictive maintenance on historian data; recommendations that support operator decisions | Predictive quality on line data before the order is reported as finished |
| 4 and 5: Business | ERP and other IT systems | Workflow optimisation with AI agents and LLMs; OT data analysed together with IT data | An assistant that answers "why is order 4711 late?" from ERP dates and an MES extract |
Some of the most useful AI tasks sit exactly on the boundary:
- Plan versus actual. Compare ERP standard consumption and times with what the MES reported, and explain the largest gaps in words a planner can check.
- Failed integration messages. In Microsoft's integration, a message that still fails after three processing attempts is set to Failed, and messages for different orders may be processed out of sequence (Microsoft Learn). An assistant can summarise why each failed and what to check; a person fixes and reprocesses it.
- Questions across both systems. Planners and supervisors ask in plain language, and the answer cites order and lot numbers. Our guide to text-to-SQL on production databases covers how to do this safely.
For any of these, both systems must use the same identifiers for orders, materials, lots and equipment. ISA-95 object models, B2MML and the OPC UA companion specification for ISA-95 give common definitions; data contextualisation covers the mapping work.
What should AI not do in MES and ERP?
AI should not keep its own copy of orders, stock or genealogy, and it should not change master data, orders or quantities on its own.
The evidence for caution is direct. In a peer-reviewed study, an LLM agent built to operate a simulated garment MES through natural language reached 80% execution accuracy on 55 manually designed requests (Yuan et al., 2025). That is a good research result and an unacceptable error rate for unsupervised writes to production records.
ERP vendors now give agents broad reach. Microsoft's Dynamics 365 ERP MCP server lets agents perform "nearly any function that's available to a user through the application interface", limited by the security role of the agent's user (Microsoft Learn). The role, not the prompt, is the boundary. OWASP's advice for LLM applications is the same: enforce authorisation in downstream systems "rather than relying on an LLM to decide if an action is allowed", and require a human to approve high-impact actions (OWASP LLM06:2025).
On the MES side, the line is closer to the process. The CISA-led guidance recommends limiting active control of OT by AI without a human in the loop, and failsafes that revert to traditional automation or manual operation. Our Purdue model guide explains where AI systems should sit on the network, and connecting an AI agent to an ERP covers roles and approvals on the ERP side.
How should you connect AI to the MES and ERP?
- List the owner of each data object using the table above, and agree it with operations, IT and finance.
- Read through supported interfaces: the vendors' APIs, data entities or curated database views, with a dedicated read-only account. Do not open new connections into the control network; data from the OT side should be pushed out, as the CISA-led guidance recommends.
- Store AI outputs separately, with the model version, the inputs used and the time, so a recommendation can be traced later.
- Show proposals where people already work: in the MES screen, the ERP or an assistant, with the order or lot numbers they refer to.
- Write only through existing transactions once read-only use is trusted, using the same messages and approvals a person or the MES would use.
- Plan for scale from the start. Interfaces to the MES and ERP must be rebuilt at every site; see from AI pilot to plant rollout.
What we have seen at KABAS AI
We have not published an MES and ERP AI project, so this section is guidance, not a reported result. DALILE runs on the client's own servers without internet access and connects to systems including ERP, MES, LIMS, SAP and SQL databases. Our manufacturing page describes it as giving unified access to production data, equipment manuals, quality records and operational knowledge through natural language queries.
The questions above decide most of the project before any model is chosen. Who owns the production order? Where does scrap get recorded, and how late? Do the MES and ERP use the same material and lot codes? Our information systems team maps business processes and integrates existing systems such as ERP, MES, SCADA and LIMS. Our consulting team runs readiness assessments and helps choose the first use case, which in a plant without an MES may be the data capture itself rather than AI.
Sources
- ISA, ISA-95 standard: Enterprise-Control System Integration
- OPC Foundation, OPC 10030 OPC UA Common Object Model: ISA-95, section 4.2.3
- NIST IR 8107, Current Standards Landscape for Smart Manufacturing Systems, 2016
- MESA International, B2MML-BatchML repository
- Microsoft Learn, Integrate with third-party manufacturing execution systems (Dynamics 365 Supply Chain Management)
- SAP Learning, Exploring the Integration of SAP Digital Manufacturing with SAP S/4HANA
- Odoo 19.0 documentation, Shop Floor overview
- CISA, ASD's ACSC and partners, Principles for the Secure Integration of Artificial Intelligence in Operational Technology, December 2025
- Yuan et al., Chat with MES: LLM-driven user interface for manipulating garment manufacturing system through natural language, Journal of Manufacturing Systems 80, 2025
- Microsoft Learn, Use Model Context Protocol for finance and operations apps
- OWASP GenAI Security Project, LLM06:2025 Excessive Agency
Frequently asked questions
What is the difference between an MES and an ERP?
The ERP plans and accounts for the business: orders, purchasing, stock and costs, over months, weeks and days. The MES runs production on the shop floor: it dispatches orders to work centres, tracks them and records what was made, consumed and scrapped, over shifts, hours and minutes. In the ISA-95 model, the ERP sits at Level 4 and the MES at Level 3.
Can an ERP replace an MES?
Sometimes. Microsoft notes that some manufacturers control shop floor activities with the native functions of Dynamics 365, while others, especially those with advanced requirements, use a third-party MES. Odoo also offers a Shop Floor module. Whether that is enough depends on how much tracking, genealogy, in-process quality and machine data your process needs.
Does AI replace the MES or the ERP?
No. AI reads data from both, predicts, explains and proposes. Orders, stock, quantities and genealogy stay in the systems that own them, with their approvals and audit trails. An AI system that keeps its own copy of production orders or stock becomes a third record that will disagree with the other two.
Should an AI agent be allowed to write to the MES or ERP?
Start read-only. A research prototype that let an LLM agent operate a simulated MES reached 80% execution accuracy on 55 test requests, so one in five requests went wrong. When writing is added, give the agent its own limited role, use the systems' existing transactions and approvals, and have a person confirm each change.
What is ISA-95 and why does it matter for AI projects?
ISA-95, also published as IEC 62264, is the standard that defines the interface between business systems such as the ERP (Level 4) and manufacturing operations such as the MES (Level 3). Its object models, and their XML implementation B2MML, give orders, materials, equipment and personnel common definitions, which helps an AI system join data from both sides correctly.



