They are indeed old as the hills. The locus classicus is the episode in the Iliad. I’ll let Thomas Nashe give the details:
Ulysses, Nestor, Diomed went as spies together in the night into the tents of Rhaesus, and intercepted Dolon, the spy of the Trojans; never any discredited the trade of intelligencers but Judas, and he hanged himself.
In fact spying figures in the work from which I’ve just quoted, Nashe’s The Unfortunate Traveller, 1594. The scene is set in the English camp at Terouanne during one of Henry VIII’s brief campaigns in France. Jack Wilton, a rascally page and the hero of the novel, persuades a foolish young fellow that his fortune will be made if he goes over to the French camp, persuades them that he is a renegade, and spies out the disposition of their forces. Why, he might even find himself in a position to do away with the French monarch thus earning undying fame and the gratitude of his countrymen.
Very earnestly he conjured me to make no man living privy to his departure, in regard of his place and charge, and on his honour assured me his return should be very short and successful. Aye, aye, shorter by the neck (thought I); in the meantime let this be thy posy: I live in hope to scape the rope.
Gone he is; God send him good shipping to Wapping, and by this time, if you will, let him be a pitiful poor fellow, and undone forever; for mine own part, if he had been mine own brother I could have done no more for him than I did, for straight after his back was turned, I went in all love and kindness to the marshal general of the field, & certified him that such a man was lately fled to the enemy, & got his place begged for another immediately.
Things, alas, do not go well for our budding spy over in the French camp. Having bragged to them how close he is to the English king, privy to all his secrets, he tells of his hatred for Henry, and asks for an interview with the king. The French smell a rat and do a Joan-of-Arc style switcheroo.
Then began he to smell on the villain so rammishly that none there but was ready to rent him in pieces, yet the minion king kept in his choler, and propounded unto him further, what of the King of England’s secrets (so advantageable) he was privy to, as might remove him from the siege of Terouanne in three days. He said divers, divers matters which asked longer conference, but in good honesty they were lies which he had not yet stamped. Hereat the true King stepped forth, and commanded to lay hands on the losel, and that he should be tortured to confess the truth, for he was a spy and nothing else.
He no sooner saw the wheel and the torments set before him but he cried out like a rascal, and said he was a poor captain in the English camp, suborned by one Jack Wilton (a nobleman’s page), and no other, to come and kill the French King in a bravery and return, and that he had no other intention in the world.
The French fall about laughing, deciding the man is a complete idiot.
Adam never fell till God made fools; all this could not keep his joints from ransacking on the wheel, for they vowed either to make him a confessor or a martyr with a trice; when still he sung all one song, they told the King he was a fool, and that some shrewd head had knavishly wrought on him, wherefore it should stand with his honour to whip him out of the camp and send him home.
Forgive the length of the post, I just find Nashe so funny that I can’t resist quoting from him. I’ll be good in future though, else I may end up getting well-deserved TLDRs in response!