  It is well known that if the most energetic cosmic rays ($E>10^{20}$ eV) were
protons then their acceleration sites should possess some extreme properties,
including gigantic luminosity. As no stationary sources with such properties
are known in the local ($D<200$ Mpc) neighborhood of the Milky Way, it is
highly likely that the UHECR acceleration takes place in some transient events.
In this paper we investigate scenario where the UHECRs are produced in strong
AGN flares. Using more than 7 years of the Fermi-LAT observations we select
candidate flares and, using correlation between jet kinetic luminosity and its
bolometric luminosity, estimate local kinetic emissivity of giant AGN flares:
$\mathcal{L}\sim3.7\times10^{44}\mathrm{erg~Mpc^{-3}~{yr^{-1}}}$. This value is
about an order of magnitude larger than the emissivity in the CRs with
$E>10^{20}$ eV, thus making this scenario feasible, if the UHECR escape
spectrum is rather hard and/or narrow. This shape of spectrum is predicted in a
number of present models of strong relativistic collisionless shocks. Also the
scenario of acceleration in AGN flares can accommodate constraints coming from
the observed arrival distribution of UHECRs. Finally, we demonstrate that in
case of heavier UHECR composition all the constraints are greatly relaxed.
