The cavity method is an alternative method, often of simpler use than the replica method, for studying disordered mean-field problems. It has been devised to deal with models on locally tree-like graphs.