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:
Pole-Dancing Stripperbot Robot
'Why, a clockwork dancer, or, better still, one that would go by electricity and never run down...' - Jerome K. Jerome, 1893.
DIY Robotic Content Farming
'The chief wheeled to the master machine and pressed a button.' - Schachner and Zagat, 1931.
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.