In the 1970s the CIA had developed a miniature listening device that needed a delivery system, so the agency’s scientists looked at building a bumblebee to carry it. They found, however, that the bumblebee was erratic in flight, so the idea was scrapped. An amateur entymologist on the project then suggested a dragonfly and a prototype was built that became the first flight of an insect-sized machine.
A laser beam steered the dragonfly and a watchmaker on the project crafted a miniature oscillating engine so the wings beat, and the fuel bladder carried liquid propellant.
Despite such ingenuity, the project team lost control over the dragonfly in even a gentle wind. “You watch them in nature, they’ll catch a breeze and ride with it. We, of course, needed it to fly to a target. So they were never deployed operationally, but this is a one-of-a-kind piece.”
(Insectothopter Robotic Dragonfly CIA video)
Video updated 03-Feb-2017
SF writer Raymond Z. Gallun thought about this sort of device as a kind of insectile spy about 75 years ago. In his 1936 story The Scarab, he wrote at length about a robotic beetle that could be used as a surveillance device:
The Scarab paused on its perch for a moment, as if to determine for itself whether it was perfectly fit for action. It was a tiny thing, scarcely more than an inch and a half in length...
...the Scarab buzzed into the great workroom as any intruding insect might, and sought the security of a shadowed corner. There it studied its surroundings, transmitting to its manipulator, far away now, all that it heard through its ear microphones and saw with its minute vision tubes.
(Read more about Gallun's scarab robot flying insect)
I should also mention the commercial fly that Philip K. Dick imagined for his 1966 novel The Simulacra.