Agents4PLC: Automating Closed-Loop PLC Code Generation and Verification in Industrial Control Systems Using LLM-Based Agents
Top Cited Papers
- 25 February 2026
- journal article
- Published by Institute of Electrical and Electronics Engineers (IEEE) in IEEE Transactions on Software Engineering
- Vol. 52 (5) , 1672-1687
Abstract
In industrial control systems, the generation and verification of Programmable Logic Controller (PLC) code are crucial for ensuring operational efficiency and safety. While Large Language Models (LLMs) have made strides in automated code generation, they fall short in providing correctness guarantees and specialized support for PLC programming (which has its own programming language and clear logical structures). To address these challenges, this paper introduces Agents4PLC, a novel framework that not only automates PLC code generation but also introduces code-level verification and repair built upon an LLM-based multi-agent system, which together is capable of directly producing operational PLC code without any human interaction. To comprehensively evaluate our framework, we first establish a new benchmark specially designed for the critical area of verifiable PLC code generation, which includes hundreds of natural language requirements, human-written and verified formal specifications, and finally reference PLC code. Then, we carefully designed a multi-agent workflow combining a set of expert agents responsible for different code generation tasks including planning, coding, validation and debugging towards generating correct PLC code. For each agent, we also incorporate optimization strategies such as Retrieval-Augmented Generation (RAG), advanced prompt engineering techniques, and Chain-of-Thought strategies which are shown to be effective to enhance the ability of these expert ‘agents’. Evaluation against the benchmark demonstrates that Agents4PLC significantly outperforms existing methods, achieving superior results across a series of increasingly rigorous evaluation metrics. This research highlights the potential of LLM agent-based code generation in real-world industrial control systems and the importance of code-level verification in generating correct code with formal guarantees.Keywords
All Related Versions
This publication has 36 references indexed in Scilit:
- The rise and potential of large language model based agents: a surveyScience China Information Sciences, 2025
- Formal Semantics and Analysis of Multitask PLC ST Programs with Preemption2024
- A survey on large language model based autonomous agentsFrontiers of Computer Science, 2024
- Application of PLC Technology in Electrical Engineering and Automation Control2020
- The Use of Programmable Logic Controllers in Railway Signaling Systems2020
- An overview of model checking practices on verification of PLC softwareSoftware and Systems Modeling, 2014
- The nuXmv Symbolic Model Checker2014
- CBMC – C Bounded Model Checker2014
- Reinforcement Learning AgentsArtificial Intelligence Review, 2002
- May the source be with youWork Study, 2000