We describe the application of an AI-driven system to autonomously align complex x-ray-focusing mirror systems, including mirrors systems with variable focus spot sizes. The system has been developed and studied on a digital twin of nanofocusing X-ray beamlines, built using advanced optical simulation tools calibrated with wavefront sensing data collected at the beamline.We experimentally demonstrated that the system is reliably capable of positioning a focused beam on the sample, both by simulating the variation of a beamline with random perturbations due to typical changes in the light source and optical elements over time, and by conducting similar tests on an actual focusing mirror system.