Libya agrees to form unified government