Summary 1. Agricultural intensification reduces ecological resilience of land-use systems, whereas paradoxically, environmental change and climate extremes require a higher response capacity than ever. Adaptation strategies to environmental change include maintenance of shade trees in tropical agroforestry, but conversion of shaded to unshaded systems is common practice to increase short-term yield. 2. In this paper, we review the short-term and long-term ecological benefits of shade trees in coffee Coffea arabica, C. canephora and cacao Theobroma cacao agroforestry and emphasize the poorly understood, multifunctional role of shade trees for farmers and conservation alike. 3. Both coffee and cacao are tropical understorey plants. Shade trees in agroforestry enhance functional biodiversity, carbon sequestration, soil fertility, drought resistance as well as weed and biological pest control. However, shade is needed for young cacao trees only and is less important in older cacao plantations. This changing response to shade regime with cacao plantation age often results in a transient role for shade and associated biodiversity in agroforestry. 4. Abandonment of old, unshaded cacao in favour of planting young cacao in new, thinned forest sites can be named ‘short-term cacao boom-and-bust cycle’, which counteracts tropical forest conservation. In a ‘long-term cacao boom-and-bust cycle’, cacao boom can be followed by cacao bust due to unmanageable pest and pathogen levels (e.g. in Brazil and Malaysia). Higher pest densities can result from physiological stress in unshaded cacao and from the larger cacao area planted. Risk-averse farmers avoid long-term vulnerability of their agroforestry systems by keeping shade as an insurance against insect pest outbreaks, whereas yield-maximizing farmers reduce shade and aim at short-term monetary benefits. 5. Synthesis and applications. Sustainable agroforestry management needs to conserve or create a diverse layer of multi-purpose shade trees that can be pruned rather than removed when crops mature. Incentives from payment-for-ecosystem services and certification schemes encourage farmers to keep high to medium shade tree cover. Reducing pesticide spraying protects functional