CO_2 and H_2O are the important greenhouse gases in the atmosphere.On-line monitoring of CO_2 and H_2O concentrations in ecosystem can be used for analyzing environment and climate change.With the near-infrared absorption lines of CO_2 and H_2O, CO_2 and H_2O on-line detection instrument in open-path based on tunable diode laser absorption spectroscopy (TDLAS)technology and automatic gain adjustment technology is designed.The continuous observation experiment is carried out in Yucheng Integrated Experimental Station, Chinese Academy of Sciences with the time resolution of 20 Hz in 1238 m optical path by this instrument.The results show that the problem of large signal intensity fluctuation in open-path detection is solved by automatic gain adjustment.The CO_2 concentration in site has an obvious diurnal periodicity that the concentration is low in the daytime and high at night.Comparing with LI-7500 of eddy covariance system, the data consistency is better.This technology has the characteristics of high sensitivity, fast response and without sampling, so the stable and continuous CO_2 and H_2O on-line detection is achieved in large-scale regional ecosystem.