The agreement followed concerns that continued clashes would undermine the deal to end the war between the US and Iran.