A series of azobenzene-loaded metal-organic frameworks were synthesized with the general formula M-2(BDC)(2)(DABCO)(AB)(x) (M = Zn, Co, Ni, and Cu; BDC = 1,4-benzenedicarboxylate; DABCO = 1,4-diazabicyclo[2.2.2]octane; and AB = azobenzene), herein named M-1.AB(x). Upon occlusion of AB, each framework undergoes guest-induced breathing, whereby the pores contract around the AB molecules forming a narrow-pore (np) framework. The loading level of the framework is found to be very sensitive to the synthetic protocol and although the stable loading level is close to M-1.AB(1.0), higher loading levels can be achieved for the Zn, Co, and Ni frameworks prior to vacuum treatment, with a maximum composition for the Zn framework of Zn-1.AB(1.3). The degree of pore contraction upon loading is modulated by the inherent flexibility of the metal-carboxylate paddlewheel unit in the framework, with the Zn-1.AB(1.0) showing the biggest contraction of 6.2% and the more rigid Cu-1.AB(1.0) contracting by only 1.7%. Upon heating, each composite shows a temperature-induced phase transition to an open-pore (op) framework, and the enthalpy and onset temperatures of the phase transition are affected by the framework flexibility. For all composites, UV irradiation causes trans -> cis isomerization of the occluded AB molecules. The population of cis-AB at the photostationary state and the thermal stability of the occluded cis-AB molecules are also found to correlate with the flexibility of the framework. Over a full heating-cooling cycle between 0 and 200 degrees C, the energy stored within the metastable cis-AB molecules is released as heat, with a maximum energy density of 28.9 J g(-1) for Zn-1.AB(1.0). These findings suggest that controlled confinement of photoswitches within flexible frameworks is a potential strategy for the development of solid-solid phase change materials for energy storage.