We track the coevolution of supermassive black holes (SMBHs) and their host galaxies through cosmic time. The calculation is embedded in the galform semi-analytic model which simulates the formation and evolution of galaxies in a cold dark matter (CDM) universe. The black hole (BH) and galaxy formation models are coupled: during the evolution of the host galaxy, hot and cold gas are added to the SMBH by flows triggered by halo gas cooling, disc instabilities and galaxy mergers. This builds up the mass and spin of the BH, and the resulting accretion power regulates gas cooling and subsequent star formation. The accretion flow is assumed to form a geometrically thin cool disc when the accretion rate exceeds , and a geometrically thick, radiatively inefficient hot flow when the accretion rate falls below this value. The resulting quasar optical luminosity function matches observations well, and the mass of the SMBH correlates with the mass of the galaxy bulge as in the observed Mbh–Mbulge relation. The BH spin distribution depends strongly on whether we assume that the gas in any given accretion episode remains in the same plane or it fragments into multiple, randomly aligned accretion episodes due to its self-gravity. We refer to these cases as the ‘prolonged’ and ‘chaotic’ accretion modes, respectively. In the chaotic accretion model there is a clear correlation of spin with SMBH mass (and hence host galaxy bulge mass). Massive BHs (M > 5 × 108 M⊙) are hosted by giant elliptical galaxies and are rapidly spinning, while lower mass BHs are hosted in spiral galaxies and have much lower spin. Using the Blandford–Znajek mechanism for jet production to calculate the jet power, our model reproduces the radio loudness of radio galaxies, low ionization emission regions (LINERS) and Seyferts, suggesting that the jet properties of active galaxy nuclei (AGN) are a natural consequence of both the accretion rate on to and the spin of the central SMBH. This is the first confirmation that a CDM galaxy formation model can reproduce the observed radio phenomenology of AGN.