The khanaka was the first building of Lyabi-Hauz ensemble. It was a place for staying and meditations of Sufis. This is a massive rectangular construction with central cruciform domical hall and hudjras in the corners. Some time later there was built the pool and a caravanserai made by Nadir Divan-Beghi on its other side. At the grand opening of the caravanserai Sufi sheikhs advised Imamkuli-khan (1611 — 1642) to give his compliments to Nadir Divan-Beghi for the building made "for the glory of Allah". After that Nadir Divan- Begni had to make the caravanserai a madrasah. The reconstructed portal was ornamented with flying phoenixes.