He was the oldest son of Yang Xiong (楊雄), a distant nephew of the Sui dynasty's founder Emperor Wen, who was considered one of the four most powerful officials at one point early in Sui, with Gao Jiong, Yu Qingze (虞慶則), and Su Wei and who was created an imperial prince with various titles, eventually the title of Prince of Guan.
Late in the reign of Emperor Wen (some time between 601 and 604), Yang Gongren became the governor of Gan Province (甘州, roughly modern Zhangye, Gansu).
It was said that he had a good grasp on general governance and intentionally refused to dwell on details, and that in doing so comforted the non-Han residents of the province.
Yang Gongren was considered honest and was not tolerated by Pei Yun, and therefore was instead commissioned to lead the army against agrarian rebels in the modern Hunan region.
Emperor Gaozu soon made Yang Gongren the commandant at Liang Prefecture (涼州, roughly modern Wuwei, Gansu), because of his familiarity with the region.
In 623, Emperor Gaozu recalled Yang to Chang'an to be Zhongshu Ling (中書令), the head of the legislative bureau of government, considered to be a chancellor post as well.
In 631, he became the commandant at Luo Prefecture (洛州, roughly modern Luoyang, Henan), an important location as the effective eastern capital.