South Sudan has billions of barrels of oil, but the pipeline to export it runs through the north. The south shut down production last winter, which deeply wounded the economies on both sides of the border, leading to skyrocketing inflation, protests and rising discontent.

Since then, negotiations have gone around and around, with increasing pressure by the United States, the African Union and the United Nations to come to an agreement. Since Sunday, Omar Hassan al-Bashir, the president of Sudan, and Salva Kiir, South Sudan’s leader, had been holed up together in negotiating rooms in Addis Ababa, Ethiopia, trying to hammer out a compromise. For years, the two men fought each other on the battlefield, and it seems that the history of bitterness has been extremely difficult to overcome.

On Thursday, Mr. Bashir and Mr. Kiir emerged to announce that they would demilitarize the border — a step that had been agreed to in principle last year but was almost instantly violated when Sudan began a brutal counterinsurgency campaign in the Nuba Mountains, near the border. The two sides also committed to resuming cross-border trade and allowing citizens from each side to move freely.

And they agreed to resume oil production — again, an issue that had been previously covered, with a deal reached in August, but had not yet taken effect because of mutual mistrust. “This basically kicks the can down the road,” said EJ Hogendoorn, the Horn of Africa director for the International Crisis Group, a conflict-prevention organization.

“Oil production will give both governments some breathing room, since their economies were collapsing, but unless there is a resolution to Abyei” and other conflict-ridden parts of Sudan, he said in an e-mail, “enormous frictions remain.”