How Does Espionage Work in Civilization 7?

To activate this mode, you will need to spend your agents and send them to other cities. Spies can carry out various missions, such as stealing new technology developments, sabotage, and gathering different types of information. For example, a spy might tell us about the best gaming goods stores. However, if you overuse this, you have a high chance of your agents being exposed. If you don’t protect yourself, you might face an attack that you are not prepared for. 

How to Protect Yourself from Espionage?

You need to know a few rules: 

Fully research counterintelligence technology and unlock the civilian institute "Authority" in the Civic Tree. "Authority" becomes available after researching the "Piety" institute.
Use the action "Counterspy." Open the menu and choose the leader you want to use counterespionage against. In the game menu, select "Espionage" and click on the "Counterspy" option. This is an irreversible action, lasting for 20 turns and costing 80 Influence in the Research Era or 120 Influence in the Modern Era.
After some time, choose your target wisely. Congratulations, you can now use counterespionage against only one player at a time. Be sure to pay attention to leaders who frequently use espionage or have ill intentions towards you. 

Espionage in Civilization 7
Applying counterespionage against another leader provides certain benefits:

Increases the time required for espionage missions threefold
Raises the cost of influence per turn for spies
Increases the chances of an espionage mission being exposed
Reduces the likelihood of a successful espionage attack
Of course, without proper knowledge of espionage, just like without mechanical skills in CS 2, you won’t get far.