The hosts required an injury-time winner by Sergio Agüero to see off brave, battling and occasionally brilliant Bristol City.