This could be a slipping belt. There is a sensor on the compressor that senses that the belt is slipping and shuts it down. The only way to get it to reengage is to shut off the engine and restart.
The other thing could be the automatic climate control temp sensor. There is a fan that is on any time the ignition on. This fan draws cabin air over the temp sensor.
Ensure that the fan is turning any time the ignition is on.