For economic and ecological considerations and following reasons for the depletion of certain oil resources, the coupling of renewable energy sources with the production of hydrogen by electrolysis of water contributes to the development of intelligent networks called Smart Grid (SG). In this context, this paper aims to develop an algorithm for the management and control of a hybrid microgrid by multi-agent system (MAS). This hybrid Microgrid is composed of a photovoltaic source (PVECS), a fuel cell (PEMFC), an electrolyzer (ELZ), and a hydrogen storage system (H2TANK). Oversight of this microgrid is under the control of MAS and ensures optimum performance, taking into account constraints such as intermittent renewable energy, supply / demand balance and the price per kWh.