  We have incorporated the description of the X-ray properties of Active
Galactic Nuclei (AGNs) into a semi-analytic model of galaxy formation, adopting
physically motivated scaling laws for accretion triggered by galaxy encounters.
Our model reproduces the level of the cosmic X-ray background at 30 keV; we
predict that the largest contribution (around 2/3) comes from sources with
intermediate X-ray luminosity 10^{43.5}< L_X/erg/s <10^{44.5}, with 50 % of the
total specific intensity produced at z<2. The predicted number density of
luminous X-ray AGNs (L_X>10^{44.5} erg/s in the 2-10 keV band) peaks at z
around 2 with a decline of around 3 dex to z=0; for the low luminosity sources
(10^{43}<L_X/erg/s <10^{44}) it has a broaderand less pronounced maximum around
z 1.5. The comparison with the data shows a generally good agreement. The model
predictions slightly exceed the observed number of low-luminosity AGNs at z
around 1.5, with the discrepancy progressively extending to
intermediate-luminosity objects at higher redshifts; we discuss possible
origins for the mismatch. Finally, we predict the source counts and the flux
distribution at different redshifts in the hard (20-100 keV) X-ray band for the
sources contributing to the X- ray background.
