Collective behavior of organisms creates environmental micro-niches that buffer them from environmental fluctuations e.g. temperature, humidity, mechanical perturbations etc., thus coupling organismal physiology, environmental physics and population ecology. This talk will focus on a combination of biological experiments, theory and computation to understand how a collective of bees can integrate physical and behavioral cues to attain a non-equilibrium steady state that allows them to resist and respond to environmental fluctuations of forces and flows. We analyze how honeybee clusters (Apis mellifera L.) change their shape and connectivity and gain stability by spread-eagling themselves in response to mechanical perturbations. Similarly, we study how bees in a colony respond to environmental thermal perturbations by deploying a fanning strategy at the entrance that they use to create a forced ventilation stream that allows the bees to collectively maintain a constant hive temperature. When combined with quantitative analysis and computations in both systems, we integrate the sensing of the environmental cues (acceleration, temperature, flow) and convert them to behavioral outputs that allow the swarms to achieve a dynamic homeostasis.