An innovative method for forming autonomous microgrids in local energy systems has been developed, based on deep reinforcement learning technology. To solve the problem of supplying consumers with electricity given the limited resources
of portable generators, a multi-agent architecture is employed. The key idea of the algorithm is to maximize the number of
agents making decisions about supplying network nodes while reducing their uptime. Unlike traditional approaches with a long
agent lifecycle, the proposed method improves the efficiency of microgrid formation in networks with complex topology. A literature review revealed major challenges in reinforcement learning for this task, including scalability issues. To address them, the proposed solution automatically accounts for topological constraints without requiring iterative recalculations, significantly reducing computational load and accelerating neural network model training. The algorithm is implemented using the Tianshou platform for reinforcement learning.