Science fiction meets science fact: The robots of ancient India
Ancient India had a rich literature featuring stories about robots that was originally written in Sanskrit and then translated into Chinese, Tibetan, Mongolian, Tocharian, and Pali
We usually associate robots with modern western technology. Similarly, many readers of science fiction believe that sci-fi stories featuring androids only took off in the mid-twentieth century after Asimov’s I, Robot. They would be surprised to know that ancient India had a rich literature featuring stories about robots. In fact, there were enough of these stories that according to Signe Cohen, the “robot tale” forms a genre of its own in ancient Indian literature. These stories were in Sanskrit. Many were translated early on into other languages – Chinese, Tibetan, Mongolian, Tocharian, and Pali. Thus, they reached other countries in the ancient world. The fact that the Sanskrit robot tales were translated so widely attests to their popularity. It was also fortunate, as Sanskrit stories were often written on fragile material such as birch and fig leaves, which were difficult to preserve. While some of the original Sanskrit sources are available only in fragments, many more stories have survived through these translations – some of which were much better preserved due to colder climates (having been written somewhat later also helped).

In this essay, I discuss ancient Sanskrit fiction featuring robots and androids. Here, a robot is a machine made by man, possessing humanoid characteristics, and capable of executing predetermined actions automatically. I also touch briefly on tales of other technological inventions that were actually made in the future. I interweave the discussion of the stories with speculation on the actual state of technology in the ancient world, particularly ancient India.
One such story is a swashbuckling tale spanning two centuries, featuring two real-life historical kings, and illustrating intellectual property theft through forbidden and hazardous channels. The story begins during the reign of King Ajatashatru, a contemporary of the Buddha (5th century BCE). Ajatashatru had a love-hate relationship with the Buddha; known for persecuting Buddhists early in his reign, he later regretted some of his actions (including imprisoning and killing his father) and is thought to have come under the Buddha’s influence. The story tells us that when the Buddha dies, Ajatashatru manages to appropriate some holy relics from his body. He decides to hide them from posterity in an elaborately constructed shrine. The shrine is in an obscure place and has seven layers of concentric walls, but Ajatashatru doesn’t trust human guards: he wants guards who won’t let the secret out and who would continue to prevent human access to the relics even after Ajatashatru’s death.
Luckily for him, he finds an inventor in his own capital who is skilled at making robots. It turns out that this robot-maker’s father had gone to Rome with the express design of learning how to make robots. There, he had married the daughter of the chief of the robot technicians, mastered the science of programming and making robots, and fathered a son. When the son grows up, his father flees for India, the plan for robot manufacture sewn inside a gash in his thigh. His dream is to take the technology to India and start making robots there. The Romans, who impose great restrictions on robot makers’ travels, for fear that they might disseminate the technology to foreign countries, send a robotic assassin after him. The assassin succeeds, but the son, who is party to the plan, manages to reach India as well, retrieve his father’s corpse, and find the plan sewn up in his thigh.
With the help of the plan, the son then becomes so skilled at making robots that he is able to construct armed robots for Ajatashatru’s shrine. These robots have sensors to detect approaching beings; these sensors would in turn trigger a mechanism inside the robots – they would whirl in the air and their swords would decapitate or severely injure anyone who tried to enter the gates they guarded. These robots are able to guard the shrine for more than two centuries, long after Ajatashatru’s death.
The story then moves forward in time to the third century BCE, when the Mauryan emperor Ashoka ruled over a vast empire. A recent convert to Buddhism, Ashoka longs to find the Buddha’s relics, whose location is unknown, and distribute them across shrines all over the country, so that devout Buddhists could pay their respects to the relics. He manages to find the location of the shrine Ajatashatru built, through an informant, excavates the long-forgotten shrine, but finds to his surprise that his way is barred by armed robots. Fortunately, he gets help from a descendant of the robot maker who had built the original robots. This man not only helps him disarm the robots and gain access to the relics, but also teaches him so much about controlling robots that Ashoka begins to build a robotic army with his help.
Eventually, the government of Rome hears about Ashoka’s robotic army, finds out that the Indian robots resemble those made in Rome, and makes a plan to kill Ashoka. They send him a gift through a visiting emissary – a safe ostensibly full of jewels. However, the safe actually conceals a robot with a sword: opening the safe triggers a spring mechanism, causing the robot to fly out and attack the person opening the safe. Due to his suspicions about the safe concealing a trap, Ashoka’s robot maker insists on opening the safe himself, and loses his life, though the emperor is saved.
This story was originally from a lost Sanskrit text called Lokaprajnapti. While the age of the original is unknown, it must have been well before the sixth century CE, by which time a Chinese translation was available. It was also translated into Tibetan and Pali at some time between the sixth and ninth centuries (Dietz, Siglinde,1989: A Brief Survey on the Sanskrit fragments of the Lokaprajnaptisastra). The story was so popular in China that Empress Wu, a seventh-century Tang dynasty ruler, wanted to emulate Ashoka and asked her technicians to try and build automata (Mayor, Adrienne, 2018: Gods and Robots: Myths, Machines, and Ancient Dreams of Technology). Besides illustrating the connections between ancient India and the Greco-Roman west, this story makes a subtle point by having robots kill robot-makers, not once, but twice. Thus, the writer of the original could already envisage the possibility that robots – despite their wonderful capabilities – might one day turn on the very humans who made them.

Were ancient civilizations really able to make robots? Interestingly, Mayor (2018) speculates that lifelike automata with human characteristics were probably already common by Ashoka’s time (the third century BCE). According to Gregor Reisch, Apollonius of Tyana, a first century CE philosopher, visited Taxila (which Ashoka had once ruled over) and was struck by the “dumb waiters and other automata” that Indians used. Aristocratic households seemed to have used robots to serve food and drink, at least when visiting dignitaries were present. (Reisch, Gregor Technical Devices in Ancient Alexandria and their equivalents in the Indian Cultural Area)
Were robots used for security and military purposes, as in the story? Historical accounts – as well as other stories – do suggest that kings in ancient times were using lifelike replicas of humans and animals for tactical purposes in battle. For instance, Nowrozi (Nowrozi, Nahid, 2019: The “Metal Army” of Alexander in the War against the Indian King Porus in Three Persian Alexander Books) mentions three Persian accounts (dated between the tenth and fourteenth centuries) of the 4th century BCE battle between Alexander the Great and King Porus in northwestern India. These accounts all speak of a great number of “metal men” that Alexander had his engineers make. When seen from a distance, the metal army would fool the Indians into expecting that Alexander’s army was much larger than it really was. When fired with ballast, these metal men would run forward at great speed, so as to terrify Porus’s army – and its elephants - into thinking that self-propelled metallic soldiers were rushing at them. Indian accounts of Emperor Ashoka’s life also mention the stratagem by which he became emperor, which involved causing the death of his wicked older half-brother, Sushim. According to these accounts, Ashoka’s engineers constructed a lifelike replica of Ashoka, as well as one of Ashoka’s elephant, and mounted the dummy Ashoka on the elephant replica. They were realistic enough that Sushim, mistaking them for the real Ashoka and his elephant, charged at them – and promptly fell into a pit lined with live coals, which had been carefully concealed (Cohen, Signe, 2002: Romancing the Robot and Other Tales of Mechanical Beings in Indian Literature). The first century Sanskrit playwright, Bhasa, writes in his play Pratigya Yaugadharayana about how the protagonist – a king named Udayana – is lured by a lifelike model of an elephant while on a hunting trip. When he approaches near, enemy soldiers hidden inside the model jump out and kidnap him. Thus, by the time of Ashoka, inventors were able to construct very realistic replicas of humans and animals and use them for strategic or military ends. These replicas were a step behind robots, as they were not self-propelled. However, Daoxuan, a Chinese Buddhist monk writing during Empress Wu’s reign, wrote of an actual Buddhist monastery in India which was guarded by humanoid and animal-like automata.

The Sanskrit robot tale genre often featured amusing twists. One story tells of a renowned painter, who comes to stay with an inventor. When the painter enters the guest bedroom, he is greeted by a beautiful woman who proposes, demurely but decisively, to spend the night with him. The painter is thrown off balance, and hesitates for a while thinking that the lady might be either the inventor’s sister or his wife. Eventually, he gives in to his attraction and agrees. He undresses her, only to discover to his shock and dismay that she is a robot! The next morning, the inventor comes in to see how the painter is doing, and is startled to see him hanging from a noose. He is extremely rattled, wondering whether the trauma of an encounter with a female robot has driven the painter to suicide. On closer inspection, though, it turns out that the painter has just drawn a very lifelike portrait of himself hanging from a noose. At this point, the real painter emerges from behind a curtain, laughing. The two men congratulate each other on their accomplishments and the story ends happily on a note of mutual admiration. This story comes from the Mahavastu, a 2nd century BCE Sanskrit compilation of Buddhist tales, and ancient translations of the story into Chinese, Tibetan, and Tocharian also exist (Cohen 2002).
Another “happy” robot story is even older. It is about an Indian prince who makes a robot. The prince takes the robot with him to a foreign court, where he introduces the robot as his son. No one at the foreign court has the slightest suspicion that the prince’s “son” is, in fact, an android. On the contrary, everyone is in raptures about the “son’s” graceful speech, elegant manners, and dancing skills! One day, the robot winks at the queen suggestively; her husband, the foreign king, is enraged and orders the “prince’s son” to be decapitated. The prince humbly accepts the punishment meted out to his son, but requests that he be the one to behead him. He then takes the robot apart in front of the wonderstruck court. The foreign king is so delighted at the prince’s ingenuity and at the lifelike behaviour of the robot that he heaps the prince with lavish rewards. This story is from the Buddhist canon, Tripitaka, composed in mixed Sanskrit and Pali during the Buddha’s lifetime – the late sixth and early fifth centuries BCE. Originally an oral canon, the stories were written down around the first century BCE, and were translated into Chinese and Tibetan.
A source that abounds in stories about robots – as well as other advanced technology – is the Brihatkatha (Huge Story) written by Gunadhya around the first century BCE, in Paisachi, a forgotten Indian language. Though the Paisachi original is lost to us, the Brihatkatha was translated into Sanskrit in the eleventh century by Somadeva. This Sanskrit version is known as Kathasaritasagara (the Ocean of Streams of Story). One of the stories in this version describes how a prince, in the course of his travels, enters a strange city populated entirely by robots. Though the robots move about, talk, and work, there is not a single human being in sight. The prince heads to the city’s most palatial building, where he finally discovers the one human in the entire city. This turns out to be a man named Rajyadhara, originally a carpenter, who, by several quirks of fate, found himself in an abandoned palace in an unknown place. He had always been good at making machines (and had even invented vehicles which could use pneumatic mechanisms based on compressed air to fly), and now, he turned his skills to making robots. First, he made robots that would serve him in the palace and attend to his needs; after which he made a robot population to rule over! Other stories in the Kathasaritasagara describe miniature robots who could talk or play instruments, or fly in the air for short distances, on command.
This takes us to a historical source called the Samaranganasutradhara. Written by King Bhoja, a polymath monarch who ruled over central India in the early eleventh century , much of this book is a manual for constructing novel machines. These include a vast variety of robots, including robots used for security, “musical” robots, talking robots, and robots that performed “routine” tasks like spraying cool water on bathers (essentially substituting for human attendants) (Ali, Daud, 2016: Bhoja’s Mechanical Garden: Translating Wonder across the Indian Ocean, circa. 800-1100 CE)
The book describes “mechanical gardens” where everything – trees, creepers, rain-bearing clouds, fruit, gardeners watering the plants – are artificial, but lifelike. Interestingly, other books written at the same time – as well as accounts from middle eastern travellers – provide corroborative evidence that such artificial gardens and automata did exist in Bhoja’s time. Bhoja even discusses attempts to construct a flying machine – built of light wood, shaped like a bird, and powered by the hydraulic energy of boiling vats of mercury. However, he mentions that he has deliberately left out some technical details so as not to injure the financial prospects of the technicians who were actually building these machines.

Bhoja’s plans for building flying machines find an interesting literary parallel in stories from the Kathasaritsagara – where a limited number of Greek and Indian machine-makers are said to be able to build flying machines carrying two or three people, and usually powered by using compressed air. For instance, the ex-carpenter who rules over the robot city, as well as his brother, could make such machines. The brother had also constructed mechanical flying swans that he remote-controlled and used for a less than honourable purpose; he would lower these swans into the king’s treasury through a skylight, remotely operate a lever which allowed some gold to pour into compartments in the swans, and then pull them back up. When suspected of theft, he flees to safety in a pneumatically powered flying vehicle.
The flying vehicles in some of these stories are operated by remote control – for instance, in one story, a weaver sits on a mechanical flying bird, which his friend operates remotely, allowing the weaver to climb through a princess’s palace window and court her. In others, they are more like robots, and seem to operate in a preprogrammed way. For instance, after some modifications, this mechanical bird is able to fly safely over enemy armies, causing havoc, without having someone riding on it or controlling it from a short distance away.
All the stories I have discussed in this essay are examples of early science fiction. At the same time, there seems to be evidence that suggests that the robots, and other advanced technology, they describe could, in fact, have materialized at a much earlier date than convention would have us expect. Ali (2016) speculates that the reason knowledge of these inventions died out until modern times could be that the inventions were always made on a small scale, for a limited market – usually kings and nobles, who had the money to sponsor them. They were never intended for mass production. On one hand, kings and nobles – the inventors’ main customers – did not want mass production, as they wished to preserve the novelty value of such inventions, using them to generate wonder and awe in others. On the other, inventors themselves were very cautious about divulging their trade secrets, in view of the absence of a regime to safeguard intellectual property rights. Indeed, this caution is highlighted in a couple of stories in the Kathasaritasagara. In one, an inventor takes his wife with him and flees the kingdom for fear of being captured by hostile kings and used against his will to help construct flying machines. In another, Indian inventors keep denying that they know how to make flying vehicles (even though one of them does), saying that only Greeks have the technical know how to do this. Their reason is similar – they are afraid of being exploited and forced to work against their will if their expertise becomes known. We may imagine that as long as specialized knowledge remained confined to a very few families (perhaps passed down through generations) it is in great danger of dying out completely, especially in the absence of too many sponsors.
Regardless of just how likely their existence really was, it’s entertaining to at least speculate about the possibility, and what’s more science-fictional than that?
This article first appeared in Analog magazine, issue dated January/February 2022.
Brishti Guha has a PhD in economics from Princeton and is currently an associate professor at the School of International Studies, JNU.
All Access.
One Subscription.
Get 360° coverage—from daily headlines
to 100 year archives.



HT App & Website
