On 13 February 1296 in Vienna, Agnes married Andrew III of Hungary. Afterwards, with his father-in-law's support, Andrew managed to defeat the revolt of Miklós Kőszegi and Máté Csák III, and occupy the castles of Kőszeg and Pozsony. In 1298 Andrew supported with troops his father-in-law's revolt against King Adolf of Germany. Agnes disliked tournaments, but liked sermons. Since she was small of stature, she used to wear dresses her sisters no longer wanted, which gained her praise for modesty. The death of Andrew III on 14 January 1301, at Buda, ended the male line of the Árpáds. Stephen Ákos, one of his contemporaries called him "the last golden twig of the Árpáds".
Later life
At that point, Agnes was a widow and she had no children to carry on the Árpád dynasty. However she was only 19 so was still able to remarry and have children but she never did. Agnes became a patroness of Königsfelden Monastery in the County of Tyrol, which had been founded by her mother in memory of her late husband. Agnes took her stepdaughter Elizabeth with her and went to live there in a small house near the monastery. She was one of the final members of the Arpad family. Elizabeth was expected to marry Wenceslaus III of Bohemia, but the wedding never happened since Wenceslaus instead married Viola Elisabeth of Cieszyn. Left free, she became a Dominican nun at the nearby Töss Monastery, where she gained a reputation for holiness. Agnes was depicted as pious. On the other hand, according to the 16th century Chronicon helveticum of Aegidius Tschudi, she avenged her father's murder by ordering the execution and expulsion of 1000 people, but it appears this report was to a large extent based on Swiss anti-Habsburg propaganda. Because of her good reputation, she was asked several times to act as mediator. In 1333, she established a treaty between Austria and a number of Swiss towns and regions during the Gümmenenkrieg. In 1351, she solved a dispute between Basel and Bremen and did the same in the same year for Albert II, Duke of Austria and the Swiss Confederacy. Her brothers often came to see her in Königsfelden to ask for advice. Agnes died on 10 June 1364 at Königsfelden, and was buried in the nuns' cemetery of Königsfelden Monastery.