It is based on the time of the upgrade request.
"Within each elite level, full-fare Economy Class tickets booked in Y or B are confirmed first, followed by all other fares, in the order in which the upgrade request was received."
http://www.aa.com/i18n/AAdvantage/el...desContent.jsp
I doubt an agent can change the time stamp of the request