Context : NGC 7129 FIRS 2 is a young intermediate-mass ( IM ) protostar , which is associated with two energetic bipolar outflows and displays clear signs of the presence of a hot core . It has been extensively observed with ground based telescopes and within the WISH Guaranteed Time Herschel Key Program . Aims : This paper is dedicated to the modeling of the C ^ { 18 } O and HDO lines in NGC 7129 FIRS 2 . Our goal is to investigate the chemistry in the envelope and hot core of this IM protostar . Methods : We present new observations of the C ^ { 18 } O 3 \rightarrow 2 and the HDO 3 _ { 12 } \rightarrow 2 _ { 21 } lines towards NGC 7129 FIRS 2 . Combining these observations with Herschel data and modeling their emissions , we constrain the C ^ { 18 } O and HDO abundance profiles across the protostellar envelope . In particular , we derive the abundance of C ^ { 18 } O and HDO in the hot core . Results : The intensities of the C ^ { 18 } O lines are well reproduced assuming that the C ^ { 18 } O abundance decreases through the protostellar envelope from the outer edge towards the centre until the point where the gas and dust reach the CO evaporation temperature ( \approx 20-25 K ) where the C ^ { 18 } O is released back to the gas phase . Once the C ^ { 18 } O is released to the gas phase , the modelled C ^ { 18 } O abundance is found to be \approx 1.6 \times 10 ^ { -8 } , which is a factor of 10 lower than the reference abundance . This result is supported by the non-detection of C ^ { 18 } O 9 \rightarrow 8 , which proves that even in the hot core ( T _ { k } > 100 K ) the CO abundance must be 10 times lower than the reference value . Several scenarios are discussed to explain this C ^ { 18 } O deficiency . One possible explanation is that during the pre-stellar and protostellar phase , the CO is removed from the grain mantles by reactions to form more complex molecules . Our HDO modeling shows that the emission of HDO 3 _ { 12 } \rightarrow 2 _ { 21 } line is maser and comes from the hot core ( T _ { k } > 100 K ) . Assuming the physical structure derived by Crimier et al . ( 2010 ) , we determine a HDO abundance of \sim 0.4 - 1 \times 10 ^ { -7 } in the hot core of this IM protostar . Conclusions : Herschel data combined with ground based observations have allowed us to estimate the C ^ { 18 } O and HDO abundance in the protostellar envelope and hot core of an IM protostar . The HDO abundance in the hot core is \sim 0.4 - 1 \times 10 ^ { -7 } , similar to that found in the hot corinos NGC 1333 IRAS 2A and IRAS 16293 - 2422 . The C ^ { 18 } O abundance , at \approx 1.6 \times 10 ^ { -8 } , is a factor of 10 lower than the reference value .