The aim of this work is to propose an artificial intelligence algorithm that maintains thermal comfort and air quality within optimal levels while consuming the least amount of energy from air-conditioning units and ventilation fans. The proposed algorithm is first trained with 10 years of simulated past experiences in a subtropical environment in Taiwan. The simulations are carried out in a laboratory room having around 2–10 occupants and a classroom with up to 60 occupants. The proposed agent was first selected among different configurations of itself, with the 10 th -year of training data set, then it was tested in real environments. Finally, a comparison between the current control methods and this new strategy is performed. It was found that the proposed AI agent can satisfactorily control and balance the needs of thermal comfort, indoor air quality (in terms of CO 2 levels) and energy consumption caused by air-conditioning units and ventilation fans. For both environments, the AI agent can successfully manipulate the indoor environment within the accepted PMV values, ranging from about −0.1 to +0.07 during all the operating time. In regards to the indoor air quality, in terms of the CO 2 levels, the results are also satisfactory. By utilizing the agent, the average CO 2 levels fall below 800 ppm all the time. The results show that the proposed agent has a superior PMV and 10% lower CO 2 levels than the current control system while consuming about 4–5% less energy.