Understanding to what extent the emergence of prosumers and prosumagers organized in energy communities can impact the organization and operation of power grids has been one of the major recent research avenues at the European level. In renewable-based communities aiming to reach some level of energy self-sufficiency, a key issue to be addressed is assessing how the presence of end-users playing different roles in the system (self-consuming, producing and trading, performing demand management, etc.) can influence the overall system performance. In this setting, this paper combines Distributed Artificial Intelligence and optimization approaches to assess how prosumagers and consumers pursuing different goals can influence the energy self-sufficiency of a local energy community. The residential demand is accurately modeled, and the agents’ preferences are considered in the modeling to represent a smart community. The results show that although energy community members may have conflicting individual goals, the overall system self-sufficiency can be maximized with economic benefits for all stakeholders, thus illustrating the advantages of energy communities.