Bosnia agrees to form new government