The UKUSA agreement, first called the BRUSA Agreement, was signed in March 1946 for cooperation in signals intelligence between the UK and the USA. It was extended to include Canada in 1948 and Australia and New Zealand in 1956. It was a secret agreement until 1999 when it was disclosed by the Australian Defence Signals Directorate.
Nowadays it's called the Five Eyes (FVEY). On 25 June 2010, the full text of the agreement was publicly released by Britain and the United States.
Created to share signals intelligence between allies, the agreement has streamlined the collection and analysis of intercepted data and communications. There is thought to be around 130 known listening stations worldwide. Some are huge, such as Britain's Menwith Hill complex, and some are small or even “internet of things”-size small and function automatically. The agreement standardised terminology, codes, clearances, handling procedures and access to facilities. An exchange of personnel appears common.
Governments of the UKUSA members have been careful to seem to restrain their agencies from spying on their own citizens in politician and watchdog words and very clear laws, but nothing keeps the other members of the agreement from spying on their partners' citizens and handing over that information as part of the intelligence sharing agreement. Not only that, apparently intelligence agencies are above such laws, and the laws are updated, upgraded and adapted to the actual capacities of intelligence agencies, not the other way around.