Abstract-This paper considers the optimal resource management problem for microgrids. Microgrids provide a promising approach to fulfil challenges of the integration of distributed renewable generations and energy storage systems. However, the resource management in a microgrid encounters the new difficulty, i.e. supply-demand imbalance, caused by the intermittence of renewable sources. Therefore, an optimal solution is proposed to the resource management by enhancing the communication and coordination under a multi-agent system framework. An agent is a participant, for instance, the distributed renewable generator/energy storage system of the microgrid. With this multi-agent system, the distributed optimal solution only utilizes the local information, and interacts with the neighbouring agents. Thus, single-node congestion is avoided since the requirement for a central control centre is eliminated, and it is robust against single-link/node failures. The analysis will show that the proposed solution can solve the resource management problem in an initialization-free manner. Additionally, the proposed strategy can maintain the supply-demand balance under a time-varying supply-demand deviation. The simulation studies are carried out for IEEE 14-bus and 162-bus power systems to validate the effectiveness of the proposed distributed solution.