I am only guessing but I think that "agregado" might mean "supernumerary" in English. That is, the officers shown as "agregado" were carried on the regimental lists over and above the establishment of officers for that regiment and were only made "efectivo" when a vacancy occurred in that regiment or in another unit and they were assigned to it. So while the rank was permanent army rank, the position in the regiment was as a supernumerary, perhaps for pay and tracking purposes?
For instance, in about 1811 the 1st Regiment had:
Colonel Nuno Pereira de Macedo
Lieutenant Colonel Thomas Noel Hill
Lieutenant Colonel [agregado] John Waters
Major Francisco de Mello
Major Joao Carlos de Saldhana
Major [agregado] Rodrigo Xavier de Campos.
They are not listed with the word "agregado" but are printed in italics in the regimental lists and in the almanacs. Not certain what their duties might be? Waters never joined the 1st Line as he was on the staff of the AG department.
An officer could go through this procedure as he rose in rank, such as Charles Ashworth. As a Major in British Service, appointed in the 6th Line to Lieutenant Colonel-agregado 14 August 1809, Colonel-agregado 28 February 1810, efectivo 25 July 1811 and a Brigadier 4 June 1813.
Hope this somewhat answers the question.