IoT sensors have revolutionized the capabilities of data acquisition in the most diverse sectors. However, for a long time, a huge amount of data was gathered without a practical use, due to the complexities involved in analyzing such a large amount of information. Then, the emergence of AI was fundamental to support big data analysis of the information gathered by IoT monitoring systems, enabling the identification of patterns and taking data-driven decisions to optimize the systems and processes. In this context, this study was intended to combine IoT monitoring capabilities with AI-based methods to enhance the operational performance of building and urban infrastructure for stormwater management. This study was based on a combination of experimental data and simulation. Experimental data was obtained from IoT systems in a water retention pilot used as input to an AI model whose goal was to optimize the operation of the outlet control of the vertical system. The simulated results were validated in the pilot in order to check the expected performance. Constant flow synthetic rains, triangular flow synthetic rains, and historic rain flows were used as inputs to train the AI model, as well as to validate the AI control system and analyze its behavior and performance under different rain patterns. The results indicated that the IoT-AI coupled approach was effective in identifying patterns and minimizing system overflows as well as under-utilization. In practice, this approach can lead to both better operation by reducing risks of flooding in urban systems, as well as investment efficiency by reducing the size of water retention infrastructures.