We consider the out-of-equilibrium dynamics of the Heisenberg anisotropic quantum spin-1/2 chain threaded by a time-dependent magnetic flux. In the spirit of the recently developed generalized hydrodynamics (GHD), we exploit the integrability of the model for any flux values to derive an exact description of the dynamics in the limit of slowly varying flux: the state of the system is described at any time by a time-dependent generalized Gibbs ensemble. Two dynamical regimes emerge according to the value of the anisotropy ∆. For |∆| > 1, reversibility is preserved: the initial state is always recovered whenever the flux is brought back to zero. On the contrary, for |∆| < 1, instabilities of quasiparticles produce irreversible dynamics as confirmed by the dramatic growth of entanglement entropy. In this regime, the standard GHD description becomes incomplete and we complement it via a maximum entropy production principle. We test our predictions against numerical simulations finding excellent agreement.Understanding the non-equilibrium dynamics of isolated many-body quantum systems is currently one of the most active research areas at the boundary between condensed matter and statistical mechanics. The importance of these studies lies in its multifaceted impact, ranging from fundamental settings, such as the microscopic derivation of thermodynamical ensembles [1][2][3], to more applied ones such as the precise control of quantum systems [4, 5] or the realizations of novel out-ofequilibrim phases of matter [6]. In this context, cold-atom experiments have posed basic puzzles for theoretical understanding [7], also providing a flexible playground to test and accurately validate predictions and exact results. Quite generically, one expects that many-body systems are able to act as their own reservoirs: starting from outof-equilibrium states |ψ , at long-times the expectation value of a local observableÔ approaches the thermal equilibrium one, i.e. ψ| O(t) |ψ → O eq . This hypothesis has been thoroughly investigated in sudden quantum quenches, where an high-energy initial state |ψ is evolved with a time-independent HamiltonianĤ [8]. In practice, however, for generic systems, one has to resort to numerical simulations [9] which suffer by strong limitations [10,11]. For this reason, a crucial role has been played by integrable systems, for which it is possible to derive exact predictions. Several studies have clarified that integrable models which undergo a quantum quench generically exhibit relaxation [12,13]. However, in integrable models exist infinitely many conserved quantitieŝ Q j = N n=1q j (n) whereq j (n) is a (quasi-)local operator [14][15][16][17][18][19]. The presence of an extensive set of integral of motions suggests that the generalised Gibbs ensemble (GGE) Ô GGE = Tr[Ô e − j λjQj ]/Z has to be used in place of the standard one [20,21], where the appropriate set of charges has been accurately characterized in several studies [22][23][24][25][26]. The validity of the GGE conjecture has been nowadays extensi...