Europium-containing polyoxometalates (Eu-POMs) are widely used for the fabrication of hybrid inorganic-organic luminescent materials. A few efforts have been devoted to develop active Eu-POM-based luminescent sensors and switches. In this study, highly transparent flexible self-supporting decatungsteuropate(EuW10)-agarose thin films were successfully fabricated by a facile hydrogel casting technique. It was identified that strong interactions between agarose and EuW10 by hydrogen bonds at the hydroxyl sites and densely-packed 3D network structure of agarose in the gel state account for the homogenous distribution of EuW10 and good mechanical properties of the nanocomposite films. More importantly, the obtained thin films displayed strong red emission of Eu(III) ion, and the luminescence of these thin films was sensitive to the acid and base gases. When the thin films were exposed to HCl gas, their luminescence was sharply decreased, while the luminescence was recovered upon subsequently exposing the films to NH3 gas. Such process could be repeated many times and a portable switch based on these thin films was proposed.