Master of Orion II: Battle at Antares/Espionage wars

An instant, long-range weapon
In the early game warships are slow and weak, and most empires have very few Star Bases and therefore cannot afford to have large fleets.

Spies are a "weapon" that can strike instantly, can be produced very quickly and are not too expensive to maintain, as you can see by comparing their costs with those of typical early-game warships (the "or X BC" costs apply to ships that make your fleet exceed your Command Points):

Production races vs. research races
In the very early game spying favors production races because they can most easily produce Spies and, if the maintenance cost exceeds their income, can easily switch to making Trade Goods for a few turns without losing much of their advantage in rapid colonization. And most production races are weak in early-game research, so they have a lot to gain from espionage.

Most non-Creative research races are Democracies, which is both an advantage and a handicap in Spy wars: they have a good cash income, which makes it fairly easy for them to pay for the maintenance of Spies, but they have a -10% disadvantage in counter-intelligence (defensive spying), and their fast research makes them attractive targets for espionage.

Creative races are usually Dictatorships. Their bonus techs make them attractive targets for espionage, even to non-Creative research races. Dictatorship has a +10% bonus in counter-intelligence, but Creative races are no faster early-game producers than non-Creative research races, and Dictatorships have smaller cash incomes than Democracies.

Know your enemy
As soon as you make contact, check out the other empire to see whether they are a threat or an opportunity or both in terms of spying, and especially whether they have spying bonuses or disadvantages; the Race Statistics screen and the Races Report are the tools for this. And keep checking, in case they try a "Spy rush" later.

Espionage or Sabotage
Espionage (stealing techs) is only worth trying if your opponent has a few techs you want (know your enemy!).

Sabotage (destroying the opponent's assets) may be worth trying immediately, as every race starts the game with a free Star Base and Marine Barracks. The Star Base would cost 400 PP to replace, and its loss would halve the size of fleet your victim can run without having to "buy" Command Points at 10 BC per CP. The Marine Barracks is cheaper to replace (60 PP), but a Dictatorship or Feudalism would be struggling under a 20% morale penalty while it has no Barracks.

Generally you should delay sabotage until you've stolen all the techs you actually want.

When and how many Spies
If your objective is espionage, it's worth trying 1 Spy immediately because you may catch your opponent unprepared. 1 Spy that faces no opposing defensive Agents will usually steal a tech in under 5 turns. Even if that Spy is killed without stealing a tech, you're forcing your opponent to build Spies when he/she/it would rather be building or stockpiling for something else - a significant burden for opponents who have non-production races.

After the first solo mission it's generally a good idea to make 3 to 4 Spies in a row, but keep them on counter-intelligence until you have the number you want:
 * They stand more chance of success if they catch the opponent by surprise and short of Agents.
 * Democracies have a -10% disadvantage in counter-intelligence (defensive spying), but no disadvantage in espionage and sabotage. They may retaliate by buying Spies when half built (money can be a weapon too) and then rushing you with a gang of saboteurs. Keep looking at the Races Report for evidence of counter-attacks.

Sabotage is more difficult, and you should use a gang of 3 to 4 Spies for your first mission.

Defensive spying in the early game
This generally applies most strongly to research races, including Creatives, since research races have more techs to steal and will find it harder to replace sabotaged assets.

You need to be clear about your objectives in early game defensive spying:
 * Before you research some spying techs (the earliest are Neural Scanner and Telepathic Training), enemy Spies will usually succeed in stealing 1 to 3 techs even if your Agents outnumber them 2:1 - even if you are a Dictatorship with its 10% defensive spying bonus; Democracies' -10% defensive spying disadvantage means that the enemy will steal a few techs even if outnumbered by 3:1.
 * Your initial objective is to "persuade" the other side that spying is not very productive and that there are better things to do with 100 PP.
 * Once you have at least 1 spying tech, you can think about making it nearly impossible for opponents to steal techs - and you should do so, because you'll never get rid of enemy Spies if they manage to steal spying techs.

A research race's first line of defense is its production stockpile.

But research races can seldom afford to wait until first contact before making Spies: The trickiest part is guessing when first contact is likely to happen. It's earlier in Small or crowded galaxies and in games with Average Tech or Advanced starts. But a few turns before first contact is likely, Dictatorships should build 2 Spies and Democracies should build 3 or 4. If they kill the opponent's first Spy, that might persuade the opponent to give up offensive spying for a while. But keep checking the Races Report!
 * Spies will usually succeed in stealing techs if they are opposed by only an equal number of Agents. A Dictatorship's Agents need to outnumber enemy Spies by about 2; Democracies need a superiority of about 4 in the early game, because of their -10% defensive spying disadvantage.
 * You probably only have at most 2 colonies with the industrial capacity to build Spies, possibly only 1. And each colony can only build one thing per turn, no matter how much production it has stockpiled.

Eventually you will reach a situation where you have an advantage in spying tech and you have several Agents. From this point onwards 12 Agents will generally be enough for Dictatorships and about 15 for Democracies. But keep checking the Races Report.

Replace lost Spies immediately
The end-of turn report will tell you if you have lost offensive or defensive Spies. Most governments should replace each lost Spy with 2 more until they reach 12 Agents; Democracies should replace with 3 more until they reach 15 Agents.

The same applies to Spies lost while on offensive missions: if you let your total number of Spies decline, you're vulnerable to a mass espionage or sabotage counter-attack. But if you repeatedly lose Spies on offensive missions, give it up and reinforce your defensive Agents.

Darlok deadlock
It is an interesting side note that when Darloks (or any other race with a large spying bonus) are present in a game, especially when there is only one human player, their ability to frame others for espionage eventually leads to every player hating each other, ending any treaties. This leads to players forming a more defensive posture as they cannot form alliances, leading to games lasting much longer. Naturally, this lends itself to Creative races having the advantage, who are sure to win the game if they are on an equal footing when the deadlock begins.

You can also minimize Darlok deadlock by A) wiping them out early on and/or B) being the most badass race so no one wants to antagonize you by declaring war. In this case, you will usually get a threat to discontinue treaties, but no actual DoW.