A supramolecular radical assembly that can be induced in situ by facultative anaerobic bacteria has been reported and used for selective near-infrared (NIR) photothermal antibacterial action. Herein, we report the synthesis of a water-soluble diazapyrene derivative (DAPNP), which could be in situ initiated into the corresponding radicals by facultative anaerobic bacteria, such as E. coli or S. aureus. The introduction of cucurbit[10]uril (CB[10]) alters the stacking mode of the diazapyrene radical cations, resulting in a redshift of their characteristic absorption peak from the visible region to the NIR region. Under 660 nm laser irradiation, the in situ-induced supramolecular radical assembly exhibits great photothermal conversion properties and achieves highly efficient antibacterial activity (up to 98%). In contrast, with the aerobic B. subtilis it is difficult to induce the formation of diazapyrene radical cations in situ and maintain good activity under light irradiation. In addition, DAPNP@CB[10] exhibits excellent biocompatibility and has great potential as an intelligent photothermal material for antibacterial applications.