The agreement comes after the SDF lost control swaths of territory to the government forces during weeks of fighting.