That's the Thermostat's job. Have your Thermostat or whatever device that measures temperature and shuts off the compressor checked.