Nowadays, distributed energy resources are widely used to supply demand in micro grids specially in green buildings. These resources are usually connected by using power electronic converters, which act as actuators, to the system and make it possible to inject desired active and reactive power, as determined by smart controllers. The overall performance of a converter in such system depends on the stability and robustness of the control techniques. This paper presents a smart control and energy management of a DC microgrid that split the demand among several generators. In this research, an energy management system ( EMS) based on multi-agent system ( MAS) controllers is developed to manage energy, control the voltage and create balance between supply and demand in the system with the aim of supporting the reliability characteristic. In the proposed approach, a reconfigurated hierarchical algorithm is implemented to control interaction of agents, where a CAN bus is used to provide communication among them. This framework has ability to control system, even if a failure appears into decision unit. Theoretical analysis and simulation results for a practical model demonstrate that the proposed technique provides a robust and stable control of a microgrid.