唐太宗
"Agnideśa" became a tributary state of Tang China in 632. In 644, during the Tang expansion into the Tarim Basin, Emperor Taizong of Tang launched a military campaign against Yanqi after the kingdom allied itself with the Turks. The Four Garrisons of Anxi was established with one based at Yanqi.