A Stirling engine is a heat engine that is operated by the cyclic expansion and contraction of air or other gas by exposing it to different temperatures, resulting in a net conversion of heat energy to mechanical work.