According to his autobiographical letter Confessio, thought to have been written around 450 AD and first published in the early 9th Century (the Book of Amagh, containing the earliest copy believed to exist, is in the Library of Trinity College, Dublin), an angel appeared in a dream urging him to flee from his enslavement.
BBC: Who was the real St Patrick?