In this paper, we present a new implementation of feedback due to active galactic nuclei (AGN) in cosmological simulations of galaxy formation. We assume that a fraction of jet energy, which is generated by an AGN, is transferred to the surrounding gas as thermal energy. Combining a theoretical model of mass accretion onto black holes with a multiphase description of star-forming gas, we self-consistently follow evolution of both galaxies and their central black holes. The novelty in our model is that we consider two distinct accretion modes: standard radiatively efficient thin accretion disks and radiatively inefficient accretion flows which we will generically refer to as RIAFs; motivated by theoretical models for jet production in accretion disks, we assume that only the RIAF is responsible for the AGN feedback. We find that, after an initial episode of bursting star formation, the accretion rate onto the central black hole drops so that the accretion disk switches to a RIAF structure. At this point, the feedback from the AGN becomes efficient and slightly suppresses star formation in the galactic disk and almost completely halts star formation in the bulge. As a result, the nucleus becomes a stochastically fuelled low-luminosity AGN (Seyfert galaxy) with recurrent short-lived episodes of activity after the star bursts. Our model predicts several properties of the low-luminosity AGN including the bolometric luminosity, jet powers, the effect on kpc-scale of the radio jet and the AGN lifetime, which are in broad agreement with observations of Seyfert galaxies and their radio activity. We also find that the mass ratios between the central black hole and the the host spheroid at z = 0 are ~10^{-3} regardless of the strength of either supernova feedback or AGN feedback. (abridged)