The Spy is one of the ten classes of hero, though "anti-hero" might be a more accurate descriptor. Spies live in a remote tower of the Castle called the Spy Quarters, which can only be built after the kingdom is renown enough to already have a reception hall.
Spies work as the secret agents of their governments and have many shady abilities. They can eavesdrop on any two Sims who are interacting, write secret letters, make dead drops at messenger posts, and craft poisons from various plants.
Despite presumably working for the crown, spies have many ways of disrupting the kingdom, including picking the pockets of citizens, stealing money from messenger posts, breaking criminal Sims out of the stocks, and even murdering other Sims.
Spies, like knights and monarchs, are skillful fighters, able to duel others and hone their skill by sparring and using training dummies.
According to the booklet that comes with the game:
Spies maintain communications networks, help discover (or hide) the truth, and perform the dirty work involved in politics. Spies may bribe, pickpocket, steal funds from the messenger post, craft poisons, gather herbs, engaged in combat, go hunting, gain special fighting moves by leveling up, fight more effectively without armor, eavesdrop, propose edicts, and break Sims out of stocks.