Successful improvement of the competitiveness of enterprises depends to a large extent on the efficiency of assembly and handling systems and processes (AHSP). Their efficiency can be enhanced through various optimization methods, in particular in terms of the cost reduction, reduction of the throughput times, delivery times, increased utilization of equipment, etc. One of the most effective methods for optimizing such systems is optimization with on-line simulation. Such approach requires detailed research, study and analysis of all the building blocks and parameters needed to set up an expert system of on-line simulation of AHSP of the production line. Therefore, in the doctoral thesis, the development of intelligent algorithms and the use of them for the development of digital agents and expert systems of AHSP production line is discussed in detail. The expert system, developed in the doctoral thesis, in connection with the digital twin and digital agents, constantly monitors and continuously optimizes AHSP of the production line. In the doctoral thesis, an intelligent algorithm, called "flip and insert" is developed that can automatically suggest a very competitive schedule of orders, machines, etc. in a shorter time than well-established comparable algorithms. For the needs of validating the expert system with an intelligent algorithm, a real system of production line has been built in the laboratory environment. We combined the digital AHSP with the real system over the cloud, and thus set up all the necessary frameworks of the on-line simulation and thus develop an expert system that is in constant connection with the real system and is constantly monitoring and optimizing it. The methodology for intelligent algorithm, digital agents and digital twins provides a framework for their practical application in a real production environment.