Machine learning makes it possible for challenging jobs to be finished totally on their own. Computers as well as mobile devices may make it simpler to regulate interior temperature, keep an eye on security, and carry out periodic maintenance in a smart grid (SG). The smart grids' capacity to detect cyber attacks is crucial for determining the availability and dependability of the operation. Integrity of bogus data cyber attacks in physical layers of smart grids (SGs) is highlighted in this article. This study suggests a unique method for managing the energy usage of smart grids while analysing the security of data transfer. Here, the energy efficiency of the smart grid network is evaluated using renewable energy sources (SM_RES), and the network has been watched for security evaluation in cloud computing. Multi agent Markov reinforcement learning (MAMRL) is used to analyse the security of the cloud network in the smart grid. In terms of scalability, QoS, energy efficiency, power consumption, prediction accuracy, RMSE, average precision, and data integrity, experimental study is conducted for energy management and network security. Proposed technique attained prediction accuracy 95 %, packet loss rate 77 %, RMSE 88 %, Average precision 85 %, network security analysis 97 %; scalability 95.8 %, QoS 86 %, Power consumption 35 % and energy efficiency 96 %.