What is an optimal or a sustainable external debt - for a country, region or sector? How should one monitor and evaluate debt to preclude a crisis? We use stochastic optimal control/dynamic programming to derive an optimal debt. The deviation of the actual from the optimal will serve as a Warning Signal of a crisis. There is a correspondence between Hamilton-Jacobi-Bellman equation of Dynamic Programming and the static Mean-Variance (M-V) analysis in finance. A graphic analysis of M-V is helpful to explain the implications of DP. An explicit example is the US Agricultural debt crisis.