Abkhazia's separatist president will quit and protesters will leave key government buildings in an agreement to end unrest in the breakaway region of Georgia.