The Aibo, Nao, Asimo, even Gundam -- robotics are a national institution of Japan. However, robotics started there far earlier than most folks realise. Karakuri ningyo (roughly "mechanised dolls") go back to the Edo period (1603-1868).
Karakuri ningyo are believed to have directly evolved from the earliest mechanical devices -- water clocks and early astronomical equipment -- first developed by the ancient Chinese. As that technology spread along the Korean Peninsula and across to the island nation, it was adapted for local use and bred the first Japanese automata. Japan's early interactions with Western culture also played a role in shaping the craft.
The oldest Karakuri on record was noted in the Chronicles of Japan. Known as a Sinan-sha (South Pointing Chariot), it was presented to Japanese Emperor Tenchi, took nine years to build. It consisted of a statuette of a hermit sitting atop a vehicle, and who always pointed south (essentially an early compass) The Chinese also have record of it in the classic story, Sangokushi, in which the Sinan-sha was employed to confirming bearings during battles.
The most common form of Karakuri were known as "Zashiki Karakuri". There were a very popular luxury item in the Edo period, created specifically for home entertainment. Zashiki Karakuri are most well known for the Tea-Service robot.
As described by the Karakuri-zui, Japan's oldest mechanical engineering manuscript, these automata operated using whalebone springs, cams, and levers to perform a fantastic feat: "Setting the tea cup on the tray makes the doll move, and it stops when the tea cup is removed. If the cup is replaced, the doll swivels around and returns to its original position."
Basically, putting a cup of tea on the doll's tray makes it walk forward a set number of steps and bow. Take the cup off, and the doll raises its arms, turns, and walks back to its starting position. Even more sophisticated models, like the archer automata you can see in the video below, were created during the later stages of the Edo period and employed Western-style clockwork technology.
Zashiki Karakuri were primarily built for entertainment in a private home, however they also performed two other important functions as well. "Butai Karakuri" were invented in May 1662 by clockmaker Takeda Omi and employed in theatrical performances where their subtle motions and body movements enthralled audiences with sophisticated, symbolic and graceful gestures. They were so popular that numerous plays were written specifically for Karakuri actors. Dashi Karakuri, on the other hand, were employed in religious festivals, resting atop floats and reenacting scenes from traditional myths and legends.
Some would also argue that these were not only an essential building block in robot history -- direct precursors of modern Japanese robotics and direct contributors to Japan's modernisation efforts -- but also heavily influenced the Noh, Kabuki and Bunraku theatre arts.