The recent development of flexible hollow waveguides for MID-IR lasers may be utilized transendoscopically to ablate selectively neoplastic, superficial tissues within body cavities. Study goals are to investigate theoretically and experimentally heat distribution and thermal response of cavity lining, during CO2 laser Minimally Invasive Surgery (MIS), and to thermally optimize the procedure under practical conditions. Mathematical model was developed to predict temperature distribution along cavity lining during and after the irradiation. Experimental setup was built, including all the necessary components for a fully feedback-controlled MIS (CO2 laser, hollow waveguide, suction, insufflation, electrical regulators, cavity-like phantoms, IR camera, Labview application). Thermal images of cavity lining were recorded and analyzed throughout varying conditions. Thermal gradients were obtained mathematically and experimentally. Diverse modes of heat dispersions were observed, as wel as the relative contributions of user-controlled parameters to the maximal heat of cavity lining. The software-controlled setup has demonstrated instant adaptivity to manage varying conditions, by which it automatically protects cavity lining from getting overheated. Analytical predictions and experimental measurements were highly correlated. The software-controlled systme may serve a powerful tool to control thermal side effects during MIS within body cavities.