The real-time operation of microgrids is crucial due to its ability to enhance energy resilience and efficiency. Continuous monitoring and adaptation to fluctuations in energy supply and demand ensure a stable and reliable electricity supply to local communities, even in the case of grid disturbances. This article presents an efficient and easily implementable real-time energy management and control system based on multi-agent systems for hybrid Low-Voltage Micro-Grids (LVMGs) using energy storage systems and renewable sources. The main objective of the proposed approach is to determine optimal setpoints for all microgrid components to improve overall efficiency and reduce electricity costs while satisfying multiple constraints. The well-defined flexibilities of all microgrid components to adjust their power are exploited to achieve optimal power allocation. The approach is tested and validated by developing a simulation environment using the Java Agent Development (JADE) framework, enabling the implementation of microgrid optimization through MATLAB/Simulink.