The best time to visit Uttar Pradesh is between Octobers to the month of March, although the major city remains bustling with tourists through out the year. It is advisable to check out the schedules for any of the numerous fairs and festivals listed on this site and plan your tour according to that. Nevertheless, in summers there are chances you might get affected with heat stroke or Loo as it is known locally.
As far as Agra is concerned, avoid visiting it in the month of Ramadan
when Night view of Taj Mahal is discontinued for a month. The best time
to visit Varanasi and Allahabad is between September and November when
the monsoon rain cleanse the river and make it worth taking a dip.
Summers are completely avoidable otherwise.