Not ordinarily kept in glass jars (although if you wanted to keep track of yours, it might not be a bad idea), Bandai's Hex Bug robotic toys spend their time skittering around on level surfaces blindly following their limited programming. Just like real bugs.
They're interactive, too. Clap your hands and they change direction. When they bump into each other, or something else, they change direction, too.
(Bandai Hex Bug youtube video)
For myself, I never look at these toys without thinking of their literary ancestors - like the robotic scarab beetle from Raymond Z. Gallun's classic 1936 short story The Scarab:
The Scarab rubbed its hind legs together, as flies will do when at rest. Then, apparently satisfied that it was in condition, it unfolded the coleoptera-like plates over its wings. With a buzz that any uninformed person would have mistaken for that of a beetle, it started out on its journey.
(Read more about scarab robot insect)
Robotic insects are all the rage with researchers; see these articles for more:
Technovelgy (that's tech-novel-gee!)
is devoted to the creative science inventions and ideas of sf authors. Look for
the Invention Category that interests
you, the Glossary, the Invention
Timeline, or see what's New.
Illustrating Classic Heinlein With AI
'Stasis, cold sleep, hibernation, hypothermia, reduced metabolism, call it what you will - the logistics-medicine research teams had found a way to stack people like cordwood and use them when needed.'
Deflector Plasma Screen For Drones ala Star Wars
'If the enemy persists in attacking or even intensifies their power, the density of the plasma in space will suddenly increase, causing it to reflect most of the incoming energy like a mirror.'