The narrative was mentioned in the Valmiki Ramayana (Aranyakanda, Section 11). This is what Rama said to Lakshmana when they were approaching Sage Agastya's ashrama in Dandakaranya.
The righteous Agastya it is who, wishing for the welfare of the worlds, destroying by virtue of his austerities a Daitya resembling Death, hath rendered this quarter habitable. Once on a time here dwelt together two mighty Asuras, brothers given to slaughtering Brāhmanas—the wily Vātāpi and Ilwala. Wearing the form of a Brāhmana, and speaking Sanskrit, the cruel one used to invite Vipras to a Srāddha. And, cooking his brother wearing the shape of a sheep, he used to feed the twice-born ones according to the rites prescribed for Srāddhas. Then when the Vipras had fed, Ilwala said,— "O Vātāpi, come out, uttering a loud sound." Hearing his brother's words, Vātāpi, bleating like a sheep, came out, riving their bodies. In this way, thousands of Brāhmanas gathered together, were destroyed by flesh-eating ones wearing shapes at will. (And it came to pass that once upon a time) the Maharshi Agastya, having been invited to a Srāddha, fed on the mighty Asura. Thereupon uttering—'Finished' and offering water to wash hands with, Ilwala said unto his brother, 'Come out'! And, as that brother of Vātāpi, given to slaughtering Vipras was speaking thus, that foremost of ascetics, the intelligent Agastya, said with a laugh, 'Where is the power of coming out, of the Rākshasa, thy brother wearing the shape of a sheep, who hath gone to Yama's abode?' Hearing his words, from wrath the ranger of the night prepared to assail the ascetic, and he rushed against that foremost of the twice-born ones. And, being consumed by that ascetic of flaming energy with his eyes resembling fire, the Rākshasa met his end.- Ramayana 3.11.54-66 (verse numbers are provided according to the Gita Press English edition)
Valmiki Ramayana translated by Manmatha Nath Dutt