2004 Subaru Outback 2.5L H4 engine. The air conditioner cuts off after 10 or 15 minutes of driving from cold start and typically doesn't start working again until the engine is completely cooled down. The system was vacced and recharge by a reputable shop but the issue did not improve.
Assuming the refrigerant level is correct and the compressor is OK (shop should have verified pressures) it is likely an electrical problem, some component failing as it heats up. The clutch coil or low pressure cutout switch might be failing when hot, a relay, or it might be an issue with the module controlling the AC. Some cars also have a diode in the compressor clutch wiring to prevent spikes from backfeeding into the computer, those can fail due to heat as well.
Frequently on an old car the easiest and least expensive fix for that kind of electrical issue is to hotwire around it. Scotty has done videos showing how to do this for air conditioning. (Just be absolutely sure there is sufficient refrigerant in the system before doing that or you can burn up the compressor due to lack of lubrication.)
https://www.youtube.com/watch?v=0Foh6IF9Z5I