An agent, operative, or spy was a trusted person employed by a public or commercial entity to perform specific tasks on its behalf. The term was often used to denote a person so engaged in intelligence or security operations, such as an espionage agent, a secret agent, an intelligence agent, a government agent, a double agent, or a temporal agent.
Federation Security also made use of agents. In 2285, one of them apprehended an apparently insane Leonard McCoy, but who was in fact hosting Spock's katra, at a bar, (Star Trek III: The Search for Spock)
In 2268, Nilz Baris summoned the USS Enterprise to Deep Space Station K-7 because of his fears that Klingon agents would try to sabotage the triticale stored there. Later, he criticized James T. Kirk for allowing Cyrano Jones access to the station, accusing the latter of being the agent in question, to which Kirk replied that disruption of stations was not an offense exclusive to Klingon agents. Arne Darvin was later revealed by the tribbles to be the individual they were searching for. (TOS: "The Trouble with Tribbles")
In 2365, when asked by Gul Dukat to investigate the murder of Vaatrik, Odo firmly stated he had no intention of being a Cardassian agent. Dukat pointedly clarified he was in fact asking Odo to be an investigator. (DS9: "Necessary Evil")
In 2370, Joret Dal was a Federation operative who risked his life to bring the Federation invaluable information about Cardassian strategic intentions, which could enhance the security of Bajor and other planets in the sector. Dal had grown sick of war and hoped that the information could help Starfleet deter even one pointless skirmish. (TNG: "Lower Decks")
In 2371, after discovering that Seska might actually be a Cardassian agent posing as a Maquis (later confirmed to be true), the exasperated Chakotay (her former leader) told Tuvok (who was a Starfleet agent, posing as a Maquis under Chakotay), "You were working for her. Seska was working for them. Was anyone on board that ship working for me?" (VOY: "State of Flux")
That same year, Major Kira Nerys was abducted by the Obsidian Order, surgically transformed, and told that she was actually a long-term operative named Iliana Ghemor as part of a ploy to expose the activities of Tekeny Ghemor, of Cardassian Central Command, who was suspected, correctly, of fomenting dissent. (DS9: "Second Skin")