Agentes in rebus

The agentes in rebus (, or , "magistrianoí", 'magister's men') were the late Roman imperial courier service and general agents of the central government from the 4th to the 7th centuries.
History.
The exact date of their institution is unknown. They are first mentioned in 319, but may date to Diocletian's reforms in the late 3rd century, when they replaced the earlier and much-detested "frumentarii". The central imperial administration still needed couriers, and the "agentes in rebus" filled this role. Originally they acted as dispatch carriers, but eventually assumed a variety of duties—the title itself translates as "Those Active in Matters". They fell under the jurisdiction of the "magister officiorum" (Master of the Offices), hence their alternate Greek name of "magistrianoi". They survived into the Byzantine Empire, being eventually abolished sometime in the early 8th century, as most of the "magister"s functions were taken over by the "logothetēs tou dromou". The last reference to an "agens" comes in the chronicle of Theophanes the Confessor, where the "magistrianos" Paul is recorded as having been sent on an embassy in 678.
Organization and function.
The "agentes in rebus" were formed into a "schola" of the palace, and in common with other public services of the Dominate, their service was militarized, and considered a "militia". Indeed, the "agentes" were divided into five ranks, taken from the junior cavalry officers: "equites", "circitores", "biarchi", "centenarii" and "ducenarii". Two were appointed to each province in 357, one in 395 and more again after 412. Each member of the "agentes in rebus" was normally promoted into other branches of the government. The Code of Justinian notes furthermore that the "agentes" enjoyed immunity from prosecution both civil and criminal, unless otherwise sanctioned by the Master of Offices. Senior "agentes" were regularly appointed to the post of "princeps officii" of the praetorian prefectures, the urban prefectures and the dioeceses, thus exercising control over these departments' bureaucracy and reducing its independence.
As for their function, the 6th-century historian Procopius notes in his "Secret History":
As the service handling communications and communications systems within the Empire, their duties included the supervision of the roads and inns of the "cursus publicus" (public postal system), the carrying of letters, or verifying that a traveller was carrying the correct warrant ("evectio") while using the "cursus". Further duties assigned to the "agentes" included the role of customs officers, the supervision of public works and the billeting of soldiers. They were also used to supervise the arrest of senior officials as required, to escort senior Romans into exile (such as John Chrysostom in 404), and even to assist in the enforcement of government regulation of the church. Ammianus Marcellinus and Procopius also noted their use as ambassadors on several occasions. 
Other tasks included supervising the provincial bureaucracy and delivering Imperial commands, often staying in the area to ensure their implementation. Being outside the control of the provincial governors, some "agentes", the "curiosi" (, "diatrechontes") were appointed as inspectors and acted as a sort of secret agents, for which they gained a reputation as a secret police force. As their routine assignments brought them into contact with matters of great concern to the court, and as they reported back to the court on everything they saw or heard on their varied missions, the "agentes" can be seen to have had an intelligence function, in the broadest modern sense of the term. This role, as well as their extraordinary power, made them feared: the 4th-century philosopher Libanius accused them of gross misconduct, terrorizing and extorting the provincials, "sheep-dogs who had joined the wolf pack". Nevertheless, the vast majority operated quite openly, and the claims of the "agentes" operating as a modern-day secret police are certainly exaggerated. 
The numbers of the "agentes" tended towards inflation, and the corps was viewed with a measure of mistrust by the emperors, who repeatedly tried to regulate its size: 1,174 in the year 430 according to a law of Theodosius II, and 1,248 under Leo I (457–474). Imperial edicts also regulated their promotion, which was to be strictly on seniority, with the annual exception of two officers, whom the emperor could advance at his pleasure.
In popular culture.
Harry Turtledove's alternate history novel, "Agent of Byzantium", features a "magistrianos" as the eponymous protagonist.
Gillian Bradshaw's historical novel "Imperial Purple", set in the 5th century, features one of the "agentes" and the Master of the Offices as the antagonists.
The Agents in Rebus (AIR) are featured in John Conroe's "Demon Accords" series. Conroe's AIR is a secret organization hidden in the U.S. government.
In Eric Flint's alternate history Belisarius series, the agents in rebus target enemies of Justinian and Theodora after a failed assassination attempt on the emperor.