Aims. We aim to constrain the mixing processes in low-mass stars by investigating the behaviour of the Li surface abundance after the main sequence. We take advantage of the data from the sixth internal data release of Gaia-ESO, idr6, and from the Gaia Early Data Release 3, edr3. Methods. We select a sample of main sequence, sub-giant, and giant stars in which Li abundance is measured by the Gaia-ESO survey, belonging to 57 open clusters with ages from 120 Myr to about 7 Gyr and to Milky Way fields, covering a range in [Fe/H] between ∼ −1.0 and ∼ +0.5 dex. We study the behaviour of the Li abundances as a function of stellar parameters. We infer the masses of giant stars in clusters from the main-sequence turn-off masses, and for field stars through comparison with stellar evolution models using a maximum-likelihood technique. We compare the observed Li behaviour in field giant stars and in giant stars belonging to individual clusters with the predictions of a set of classical models and of models with mixing induced by rotation and thermohaline instability.Results. The comparison with stellar evolution models confirms that classical models cannot reproduce the lithium abundances observed in the metallicity and mass regimes covered by the data. The models that include the effects of both rotation-induced mixing and thermohaline instability account for the Li abundance trends observed in our sample, in all metallicity and mass ranges. The differences between the results of the classical models and of the rotation models largely differ (up to 2 dex), making lithium the best element to constrain stellar mixing processes in low-mass stars. We discuss the nature of a sample of Li-rich stars. Conclusions. We demonstrate that the evolution of the surface abundance of Li in giant stars is a powerful tool to constrain theoretical stellar evolution models, allowing us to distinguish the impact of different mixing processes. For stars with well-determined masses, we find a better agreement between observed surface abundances and models with rotation-induced and thermohaline mixings, the former dominating during the main sequence and the first phases of the post-main sequence evolution and the latter after the bump in the luminosity function.