Hello and welcome to JustAnswer!
Assuming no fault codes are setting some testing is going to need to be done at the time it's acting up to see what is happening.
The first thing I'd recommend is checking for power at the compressor clutch. It's not uncommon for a clutch coil to fail as it heats up. If you have power at the compressor but it won't engage then the coil is bad.
It could be a bad low pressure switch on the accumulator. The switch can be jumped to test while acting up.
It could be a bad refrigerant pressure switch. This is on the high side of the system and reports actual pressure. To know if it was the issue you'd need to monitor it's signal on a scan tool against a manual gauge when it acts up.
There is also a temperature sensor on the evaporator that can prevent the compressor from engaging, it can also be checked with a scan tool.
Tray swapping the compressor clutch relay with another also. The relay could be bad and this would be a free, easy way of ruling it out.