Kavi may have originally signified an insightful fashioner in Proto-Indo-Iranian, which later acquired a poetic aspect in Indic and warrior and royal connotation in Iranian.
The earliest known foreshadowing of the major legends of the Kayanian kings appears in the Yashts of the Avesta, where the dynasts offer sacrifices to the god Ahura Mazda in order to earn their support and to gain strength in the perpetual struggle against their enemies, the Anaryas (non-Aryans, sometimes identified as the Turanians).
The result was the Khwaday-Namag or "Book of Lords", a long historiography of the Iranian nation from the primordial Gayomart to the reign of Khosrow II, with events arranged according to the perceived sequence of kings and queens, fifty in number.
Following the collapse of the Sassanid Empire and the subsequent rise of Islam in the region, the Kayanian legends fell out of favour until the first revival of Iranian culture under the Samanids.
Together with the folklore preserved in the Avesta, the Khwaday-Namag served as the foundation of other epic collections in prose, such as those commissioned by Abu Mansur Abd al-Razzaq, the texts of which have since been lost.