Over the last decade, electricity markets have created competitive environments for complex power systems. The fast growth of distributed energy resources has made it challenging to maintain the reliability and stability of the system. However, conventional energy management strategies are not capable of resolving these concerns centrally due to the volatility of distributed energy resources. Moreover, centralized electricity markets are not complete enough to follow the flexible behavior of consumers due to demand response programs. Therefore, new electricity trading structures are required to provide energy to distribution networks in a decentralized and distributed manner.This work presents a bottom-up energy management approach based on a multi-agent architecture for local electricity trading. Our proposed structure is defined as a class of organization-based multi-agent systems, where each agent has different tasks. These agents consist of distributed energy resources, electrical consumers, prosumers, electric vehicles, aggregators, a distribution system operator and local coordinators of the system.According to the proposed bottom-up approach in our Ph.D. work, decisions of agents in the bottom layer have priority in comparison to agents' decisions in the upper layers. In this way, our proposed strategy manages energy locally to pursue global-social optimization. Also, different types of electricity commodities-e.g. energy and flexibilitycan be traded locally in the distribution network.In this Ph.D. work, we define different strategies such as decentralized, partially-decentralized and centralized (community-based) for local electricity trading.Here, the challenge is to model a multi-level problem based on the objective function of agents considering uncertainty of the system's stochastic parameters. In this way, each agent can participate in different types of the electricity transactions on the basis of their corresponding objective functions. Acknowledgement I would like to take this opportunity to express my sincere gratitude to all those that have supported me over the course of my PhD. First of all, I would like to thank my supervisor, Prof. Juan Manuel Corchado Rodríguez for his patience, motivation and immense knowledge. His continuous support in my PhD study and related research have been crucial, I could not have achieved any of this without his guidance and help. Besides my supervisor, I would also like to express my gratefulness to my co-supervisor Prof. Zita Maria Almeida do Vale, for her support in my research activities and her help in the writing of this PhD. thesis.My sincere thanks also goes to Prof. Juan Miguel Morales González and Discovergy GmbH who have given me the opportunity to join their team and company as an intern, and who have provided me with access to the laboratory and research facilities. Without their valuable support it would not have been possible to conduct this research. A special thanks to Prof. João P.