I heard the Messenger of Allah ﷺ say, "No prophet was ever sent, nor any successor appointed after him, without having two inner circles of advisors. One circle commands him to do good and forbids him from evil, while the other spares no effort in corrupting him. Whoever is protected from the evil circle has truly been protected."
أخبرنا محمد بن عبد الله بن عبد الحكم عن شعيب عن الليث عن عبيد الله بن أبي جعفر عن صفوان عن أبي سلمة
سمعت رسول الله ﷺ يقول ما بعث من نبي ولا كان بعده من خليفة إلا وله بطانتان بطانة تأمره بالمعروف وتنهاه عن المنكر وبطانة لا تألوه خبالا فمن وقي بطانة السوء فقد وقي
Bukhari transmitted it in "The Book of Judgments," chapter "The Confidants of the Ruler and Those He Consults," hadith no. 7198, from the hadith of Ubaydullah bin Abu Jafar, with this wording, as a suspended narration, and it is found in Al-Kubra, hadith no. 7826.