The working mechanism of theranostic agents leverages the unique properties of nanoparticles. These particles can be engineered to target specific biomarkers on diseased cells, such as cancer cells. Once they reach the target site, the diagnostic component can provide imaging signals (e.g., fluorescence, magnetic resonance imaging) for real-time tracking, while the therapeutic component releases drugs or heat (in the case of photothermal therapy) to eliminate the diseased cells.