Recent advancements have introduced solutions such as sensor-based monitoring and adaptive traffic signals, utilizing cameras, radars, and other sensors to collect and analyze real-time data for optimizing traffic flow. While these technologies offer promising improvements, they face challenges related to data accuracy, high infrastructure costs, and scalability, particularly in complex urban environments. By addressing the limitations of current traffic management solutions, this study investigates the integration of Artificial Intelligence (AI) as a key component in Vehicle-to-Everything (V2X) communication; a connected driving technology aimed at achieving smoother and safer traffic flow. This paper proposes a novel approach to traffic optimization, not only at signalized intersections but also in non-signalized scenarios. In such settings, vehicles would operate as independent agents, communicating through a shared cloud network to enhance coordination and efficiency.