A foundational boundary runs through the Gemara itself: Rabbi Akiva is rebuked for treating an aggadic point about the frogs of Egypt as though it were his field of expertise, with Rabbi Elazar ben Azarya telling him to leave aggadah for the more exacting disciplines of Nega'im and Oholot (Sanhedrin 67b), and similarly in the account of the four who entered the pardes, the loftiest esoteric teachings prove dangerous when mishandled, with only Rabbi Akiva emerging whole (Chagigah 14b). These sugyot signal that aggadic and midrashic material occupies a different register than normative halachah, one requiring caution rather than the same binding acceptance given to legal teaching.
Yet other Chazal sources affirm that aggadah and midrash are integral to the Torah given at Sinai: Jerusalem Talmud (Peah 2:4) states that Scripture, Mishnah, Talmud, and aggadah alike were all said to Moshe at Sinai, and Tosefta Sotah 7:7 likens the words of the Sages, including aggadic teachings, to goads and firmly planted nails that give life and should not be abandoned merely because opinions differ. Sifra, Bechukotai, Section 2:1 goes further, reading the rebuke for rejecting God's statutes as a rebuke specifically for rejecting the rabbinic drashah upon the Torah, suggesting that midrashic exposition carries real authority and is not optional.
The Gemara in Shabbat 63a supplies the classical check on how far midrash may go: even once a verse is expounded homiletically, 'a verse does not depart from its plain meaning,' so that a drash is an added layer rather than a replacement for the text's own sense; Sukkah 11b likewise records an unresolved tannaitic dispute between Rabbi Eliezer and Rabbi Akiva over whether the sukkot of the Shemot were literal booths or clouds of glory, showing that midrashic claims about historical fact can themselves be subject to machlokes rather than settled dogma. The Rashbam, commenting on Rashbam on Bereishit 37:2, draws the same line: however far drashot and agadot teach beyond the bare text, no exposition may be allowed to override the plain meaning of the verse, and earlier generations who leaned heavily on drash did not thereby abandon the discipline of peshat.
The Ramban is explicit that midrashic aggadot occupy a distinct, optional category of literature: he states plainly that he does not believe that the Messiah was born on the day of the Temple's destruction, treating that aggadah as either not literally true or bearing a hidden meaning, and he compares the genre of midrash to a sermon recorded by a listener — 'whoever believes it, good, and whoever does not believe it does no harm' (Ramban).
The Maharal, in Be'er HaGolah, Well 3 1:2, insists to the contrary that all the words of derashot found in the Talmud and midrashim, great or small, reflect the true depth of the verse when the text is examined with sufficient depth, and are complete and without blemish. At the same time, in Be'er HaGolah, Well 6 15:7 he explains the principle that halachah is not derived from aggadah precisely because aggadah, unlike normative halachah, need not align with the literal truth in every detail — yet he stresses that one who denies that aggadot are Torah teachings transmitted from Sinai has no share in the World to Come, so rejection of their status as Torah is not a legitimate option even if their content is read non-literally. In Maharal, Be'er HaGolah, Be'er 6 he further likens the transmission of these deep teachings to a wedge driven partway into hard wood, entering the mind only where it is receptive, implying that the full depth of these teachings is not always grasped even by those who accept them as true.
The Rambam, in Guide for the Perplexed, Part 3:43, describes the very dispute the user is asking about as already dividing people in his own day: some regard midrashic interpretations, such as the reasons given for the four species, as the real explanation of the text, while others, finding them irreconcilable with the verse, reject and ridicule them, and the Rambam treats such aggadic readings as a kind of poetic application of the biblical language rather than a claim about the verse's actual meaning.
Rav Dessler, in Michtav MeEliyahu (Rav Dessler), draws a distinction between derash that is purely homiletical and cases where the Sages' derash is in fact the true peshat, noting that Rishonim such as the Rashbam and Ibn Ezra sometimes sought alternative plain readings precisely to show that a verse can bear multiple levels of peshat, and that a person who cannot accept a given rabbinic reading may legitimately adopt the plain sense that appeals to him, provided it does not contradict the foundations of faith.
Rav Menashe Klein, in Mishneh Halachos 5:169, rules that midrashic and aggadic interpretations may validly convey hints, moral lessons, or deeper meanings without being the plain sense of the text, and that later Torah scholars may add further interpretations so long as these are grounded in Torah, do not contradict accepted halachah or tradition, and do not deny the text's revealed meaning; in Mishneh Halachos 10:250 he further holds that halachic obligations may not be derived independently from biblical narratives or their aggadic interpretations, while aggadic readings may still be expounded along Torah principles where they do not conflict with accepted halachah, noting that there is disagreement over whether halachah may ever be learned from aggadot and midrashim.
The Radbaz, addressing midrashim that describe the festivals as destined to be nullified in Messianic times, concludes that such statements should not be read as predicting the literal abolition of the mitzvot, but rather describe a future in which joy and tranquility will be so universal that ordinary days will resemble festivals, with Purim nonetheless still observed and remembered even though its ultimate rationale shifts (Teshuvot HaRadbaz Volume 2 828); this is itself a case of interpreting a midrashic statement non-literally rather than accepting it at face value.
The Sfas Emes, commenting on the Shabbat sugya, suggests that calling a sword an ornament through the verse about Torah may still cohere with the principle that a verse does not depart from its plain sense, since Torah itself is elsewhere compared to a good wife, showing how later tradition continued to wrestle with how far a derash can be pressed against the plain text (Sfas Emes al HaShas, Shabbat 63a).
Standing behind this entire debate is the pasuk invoked for testing any teaching: 'for Torah and for testimony, surely they will speak according to this word which has no profit in it' (Yeshayahu 8:20), read here as the touchstone by which any proposed teaching, midrashic or otherwise, must ultimately be measured.