Why are spies (mostly) not given prisoner of war status?

I think that it’s fairly safe to assume that most, if not all, countries use spies in one capacity or another to get information about foreign governments. And yet, these operatives of the government when captured can be tried, convicted, and executed according to the laws of spied upon country. Assuming that they would not be performing their espionage without the encouragement and support of a government, why should they be treated differently than uniformed agents which are actively trying to kill people?

You can see various country’s attitudes toward the treatment of spies here.

Geneva Convention.

It should be said that it isn’t that spies are treated unfavourably, but that uniformed soldiers in compliance with the Geneva Convention are treated favourably as opposed to anyone else.

In order to qualify as a Prisoner of War, you have to fulfil certain criteria - such as, of the top of my head, being in uniform, in a recognised/declared war, with a real name and number. According to International Law, war has rules. Spies do not operate under these rules, so are not subject to the protections of the Geneva Convention.

War is always ugly, but it’s slightly less ugly when there’s some convention about whom it’s OK and not OK to kill. When you see a guy wearing the uniform of the enemy, you know it’s OK to kill him. When you see a guy wearing just ordinary civilian clothes, you have to assume that he’s a civilian, and not to be targeted (at least, not deliberately). When there’s a guy wearing ordinary civilian clothes but who is nonetheless acting to fight against you, it blurs those boundaries, and puts the real civilians at risk. So you want to discourage that as much as possible.

Spying is not a war crime. Spies are simply not offered the protection due to soldiers. This is done to make spying dangerous and difficult.