Spying and espionage are hard to eliminate, you would need every nation to agree to it, but then you also need every nation to agree to an audit of their finances so we can know they are not funding the wrong things.
Quite simply, I don't believe you'll ever eliminate such endeavours.
What can be done though, is accountability for crimes committed and an ability for their actions to be auditable.
Can't say you'll be able to impose it on many countries.
Edit: also what you really want, is to have your own government, elected by the people, being able to bring the hammer down on such agencies.
Spying and espionage are hard to eliminate, you would need every nation to agree to it, but then you also need every nation to agree to an audit of their finances so we can know they are not funding the wrong things.
Quite simply, I don't believe you'll ever eliminate such endeavours.
What can be done though, is accountability for crimes committed and an ability for their actions to be auditable.
Can't say you'll be able to impose it on many countries.