We derive a framework to compute optimal controls for problems with states in the space of probability measures. Since many control constrained by system ordinary differential equations modeling interacting particles converge partial equation mean-field limit, it is interesting have calculus directly on mesoscopic level measures which allows us corresponding first-order optimality system. In ad...