Israel and Hamas have agreed to a ceasefire deal, pausing the Gaza war and facilitating the release of hostages and humanitarian aid.