We introduce a generalization of the cavity, or Bethe-Peierls, method that allows to follow Gibbs states when an external parameter, e.g. the temperature, is adiabatically changed. This allows to obtain new quantitative results on the static and dynamic behavior of mean-field disordered systems such as models of glassy and amorphous materials or random constraint satisfaction problems. As a first application, we discuss the residual energy after a very slow annealing, the behavior of out-of-equilibrium states, and demonstrate the presence of temperature chaos in equilibrium. We also explore the energy landscape, and identify a new transition from a computationally easier canyons-dominated region to a harder valleys-dominated one.