The deal promises the release of dozens of hostages held by Hamas in phases and hundreds of Palestinian prisoners in Israel.