Nanocarriers are frequently used for drug delivery due to their large surface area, biocompatibility, and photothermal effects. However, they face the problem of premature drug leakage during drug transport. To address this challenge, we developed near-infrared light (NIR)-responsive hollow magnetic nanocarriers (HMC) by incorporating a chitosan-based molecular valve onto hollow magnetic nanocarriers (CHMC) to enable NIR-triggered drug release. Despite this advancement, this material still encounters the challenge of inadequate targeting. Recognizing the efficacy of magnetically driven micro/nanorobot swarms in remote wireless control, targeted motion, and efficient transport, we merged CHMC with magnetically controlled micro/nanorobot swarms. We evaluated their performance under programmable magnetic fields, which can be precisely controlled in biological fluid and directed toward targeting cells. Additionally, they demonstrated the ability to execute a responsive drug release under NIR irradiation. Ultimately, we confirmed their capacity for targeted delivery, responsive drug release, and photothermal therapy for liver cancer treatment in vivo. This approach heralds new possibilities for responsive drug therapy facilitated by micro/nanorobot swarms, offering promising advancements in medical treatment.