Demethylating agents typically inhibit DNA methyltransferases (DNMTs), enzymes responsible for adding methyl groups to the cytosine residues of DNA. By blocking the activity of DNMTs, these agents prevent the addition of methyl groups and can also promote the removal of existing methyl groups. This leads to a reduction in DNA methylation levels, which can reactivate silenced genes and alter cellular function.