Since the 1950s, intensive and specialized agricultural systems using a few select species and relying heavily on agrochemical inputs have enabled a huge increase in food production. However, in parallel, drawbacks appeared including biodiversity loss, greenhouse gas emission, erosion, and water pollution. Today shifting farming systems to mitigate soil degradation trends is indispensable. Using viability theory, we propose a dynamic model of the sequence of agricultural productions and practices that can be implemented in the long term to restore soil quality while respecting a set of agronomic and economic constraints. The paths to soil restoration vary depending on agronomic and economic constraints, the time available for restoration, the initial soil conditions, and investment capacities. Economic valuation of the minimum cost of restoration shows that the agroecological transition may be costly and that farmers can have difficulty meeting the costs, thus raising the question of how the cost of agroecological transition is to be shared.