  Softwarization, programmable network control and the use of all-encompassing
controllers acting at different timescales are heralded as the key drivers for
the evolution to next-generation cellular networks. These technologies have
fostered newly designed intelligent data-driven solutions for managing large
sets of diverse cellular functionalities, basically impossible to implement in
traditionally closed cellular architectures. Despite the evident interest of
industry on Artificial Intelligence (AI) and Machine Learning (ML) solutions
for closed-loop control of the Radio Access Network (RAN), and several research
works in the field, their design is far from mainstream, and it is still a
sophisticated and often overlooked operation. In this paper, we discuss how to
design AI/ML solutions for the intelligent closed-loop control of the Open RAN,
providing guidelines and insights based on exemplary solutions with
high-performance record. We then show how to embed these solutions into xApps
instantiated on the O-RAN near-real-time RAN Intelligent Controller (RIC)
through OpenRAN Gym, the first publicly available toolbox for data-driven O-RAN
experimentation at scale. We showcase a use case of an xApp developed with
OpenRAN Gym and tested on a cellular network with 7 base stations and 42 users
deployed on the Colosseum wireless network emulator. Our demonstration shows
the high degree of flexibility of the OpenRAN Gym-based xApp development
environment, which is independent of deployment scenarios and traffic demand.
