In 819, by which time Yuan was serving as the secretary general of Guo Prefecture (虢州, in modern Sanmenxia, Henan), he was recalled to Chang'an to serve as "Shanbu Yuanwailang" (), a low-level official at the ministry of rites (禮部, "Libu"). Then-chancellor Linghu Chu, himself a talented writer, had long been impressed by Yuan's literary abilities, requested that he submit his writings to Linghu. Yuan did so, and the writings impressed LInghu greatly, comparing him to the Liu Song Dynasty poets Bao Zhao () and Xie Lingyun. Meanwhile, Emperor Xianzong's son and crown prince Li Heng, who had heard his concubines recite Yuan's poetry and referring to Yuan as "Savant Yuan" (), was impressed.