Since they are machines, they must be powered by a source. A power source could be a battery, or it can derive its power from the body’s chemical reactions. It may also use light and magnetic fields to power itself.
This is a vital component of the nanobot, which can be programmed to sense any anomaly in a cell. For example, cancer cells produce a lot of lactate which can be used as an indicator to detect cancerous cells