It is an ambitious vision — one that eschews a muscle-bound foreign policy, dominated by the military and intelligence services, in favor of energetic diplomacy, foreign aid and a more measured response to terrorism. But it is fraught with risks, and hostage to forces that are often out of the president’s control.