In Spain, the legislative definition of agency is regulated in Law 40/2015, of October 1, on the Legal Regime of the Public Sector.
Autonomous agencies and state agencies have their own legal personality, their own treasury and assets, and autonomy in their management, while the AAIs have their own legal personality, their own assets, but they have independence in their management, not autonomy.
The AAIs can be compared to the independent agencies of the United States, since they are independent of the executive branch insofar as they are regulated by their own special legislation that includes special mechanisms to ensure their independence, as is the limitation for the executive branch to appoint and dismiss the high officials of it, with greater control of the legislative branch.
The state agencies (AE) are created to comply with specific policies, with better mechanisms to ensure better management and control of results.
Finally, the AAIs are assigned external regulatory or supervisory functions over economic sectors or specific activities that require functional independence or special autonomy from the executive branch.