A Stirling engine is a heat engine that operates by cyclic compression and expansion of air or other gas, the working fluid, at different temperature levels such that there is a net conversion of heat energy to mechanical work. The engine is like a steam engine in that all of the engine's heat flows in and out through the engine wall.