Espionage is illegal in most if not all countries, so essentially anything you do outside of your borders is illegal. If agents from foreign country do the same things in your country that you ask your agents to do in foreign countries, you throw the former into jail and pay the later. It's an interesting philosophical topic.