The tentative agreement worked out by the two sides comes at a moment when the fragile ceasefire between the U.S. and Iran appeared to be wavering