My Ac works for awhile and then goes off, is that a sensor problem? on 2007 Hyundai Tucson

Checked tonight and started engine, AC compressor went on and SUV got cold. It semms to be an intermittent occurence! Will check to see there is a diagnostic code tomorrow.

Asked by for the 2007 Hyundai Tucson