I was thinking somewhat along those lines. Attached to a regiment for training purposes in the depot, to assist in the regiment [according to the theory that a British Officer in command had a junior Portuguese under him and similarly a Portuguese Officer had a British officer under him etc.] or just for pay purposes?
But then you get an anomaly as for instance in the 16th Regiment where the Portuguese Colonel in 1811 is then a Colonel agregado under another Portuguese Colonel in the same regiment in 1813.
It would seem that the practice of 'agregado' covered a number of different situations.