abstract: Strarting from Lagrangian mechanics, we recall the definition of action and we focus on the related minimisation problem. In this way, we get to the notion of value function and to the Dynamic Programming Principle, which stems from a remarkable semigroup property of this function. The aim of the talk is showing that this relationships are of a very general nature and that they indeed hold in the abstract setting of metric spaces.