What is the oldest depiction someone has seen of an angel on a person's shoulder advising him to do the right thing, and a devil on the same person's other shoulder tempting him toward an immoral act?
As comments have pointed out, the idea of having good and bad angels is ancient.
However, the literary work that popularised the trope is probably Christopher Marlowe's play The Tragical History of the Life and Death of Doctor Faustus, commonly referred to simply as Doctor Faustus. (Published somewhere between 1589 and 1592)
The play draws on a pre-existing legend, but introduced several new elements, including the good and bad angels.
Faustus instructs his servant Wagner to summon Valdes and Cornelius, a famous witchcrafter and a famous magician, respectively. Two angels, called the Good Angel and the Bad Angel, appear to Faustus and dispense their own perspectives of his interest in magic and necromancy. Though Faustus seems momentarily dissuaded, he is apparently won over by the Bad Angel, proclaiming, "How am I glutted with conceit of this" ("conceit" meaning the possibilities magic offers to him).
When Faustus announces his intention to renounce magic and repent, Mephistophilis storms away. The good and evil angels return to Faustus: the Good Angel urges him to repent and recant his oath to Lucifer, but the Evil Angel sneers that Faustus will never repent. This is the largest fault of Faustus throughout the play: he is blind to his own salvation and remains set on his soul's damnation.
An illustration for a 1468 edition of City of God (De civitate Dei) by Augustine of Hippo depicts angels and demons surrounding a writer, trying to influence what he writes. An angel floats above his left shoulder, and a devil stands by his right shoulder, both somewhat smaller than the human.
The image can be seen on this stock photo site.
I found this in a thorough answer on Quora to a similar question.