Article snapshot taken from Wikipedia with creative commons attribution-sharealike license.
Give it a read and then ask your questions in the chat.
We can research this topic together.
The State Procurator's Office (in Portuguese, Advocacia Pública) is a public organ connected to the Executive branch that aims to ensure an efficient management of public assets by representing the State as a legal entity in both domestic and international disputes and by giving legal counsel.
It is internally divided in units (Procuradorias) for the Union and for States throughout the territory. In addition, it is sorted into specialized sections according to the substantial matters under discussion, as follows: Office of the General Counsel for the Federal Government (Advocacia Geral da União), for the Federal Treasury (Procuradoria Geral da Fazenda Nacional) , for the National Bank (Procuradoria Geral do Banco Central) and for Federal Matters (Procuradoria Geral Federal), all at the Union level, and Offices of the General Counsel for the State Government (Procuradoria Geral do Estado) at State levels. This arrangement was designed with the goal of separating the concerns of the State from the worries of the current members of the government.
The Federal Constitution is silent on Municipal offices, but considering that there is no explicit prohibition, most municipalities have instituted their own State Prosecutor's Office.