The penetration of weather dependent renewable energy sources which are highly stochastic in nature create new challenges with system security, reliability, flexibility, and sustainability. This research focuses on the development of an artificial intelligence-based control method for a laboratory-scale hardware-in-the-loop microgrid setup. This setup features a variety of loads, battery banks, protection relays, renewable and nonrenewable sources of energy, and advanced metering devices interfaced through standard communication protocols. A resilient, cost-effective distributed control strategy allows flexible and reliable autonomous operation and control of the microgrid. Thus, a deep reinforcement learning based multi-agent system is the primary focus for grid control in this research. These intelligent agents learn from the microgrid environment and take actions to maximize their cumulative rewards based on prior experiences. The agents receive rewards for taking good actions and are penalized for bad actions. The results obtained in this research prove the feasibility of this approach.