Sometimes the space station spends almost 24 hours a day in full sunlight. In these conditions - the "extreme beta angle" - AMS is in real danger of overheating, and may have to shut down partially. At other times, AMS may get cold, which is a danger to the mechanical components of, e.g., the TRD gas system.
There are several thermal systems on AMS. The most complex is the tracker thermal control system, which has to conduct some 200 watts out of the middle of the detector. This is done with high thermal conductivity metal bars, coupled to an actively controlled CO2 two-phase (evaporation/condensation) cooling loop. Another high-conductivity system cools the magnet cryocoolers by using capillary (passive) pumped ammonia to carry heat. For AMS's other detectors, we use passive cooling: heat conductors, sealed pipe loops with high pressure ammonia, and insulation with multilayer blankets. In any case, the heat is brought out to radiators on the outside of AMS, and rejected into cold space. The construction of the passive systems has to be compliant with severe Space Station specifications. Also, an enormous amount of effort goes into thermal modeling and simulations in order to predict AMS temperatures in varying seasons, AMS operational modes (from completely switched off, to magnet charge, to full operations) and Space Station orientations.