We investigate what powers hyperluminous infrared galaxies (HyLIRGs; LIR(8-1000um)>10^13 Lsun) at z~1-2, by examining the behaviour of the infrared AGN luminosity function in relation to the infrared galaxy luminosity function. The former corresponds to emission from AGN-heated dust only, whereas the latter includes emission from dust heated by stars and AGN. Our results show that the two luminosity functions are substantially different below 10^13 Lsun but converge in the HyLIRG regime. We find that the fraction of AGN dominated sources increases with total infrared luminosity and at LIR >10^13.5 Lsun AGN can account for the entire infrared emission. We conclude that the bright end of the 1<z<2 infrared galaxy luminosity function is shaped by AGN rather than star-forming galaxies.