Automata and Mechanical Wonders: Humanity's First Experiments in Programming Behavior
Hero of Alexandria, Al-Jazari, and Leonardo da Vinci — the engineers who translated the dream of artificial life into working machines.
AI HISTORY SERIES --- EPISODE 2
Automata and Mechanical Wonders
Humanity’s First Experiments in Programming Behavior
Introduction: From Myth to Mechanism
In the opening episode of this series, we explored the deep roots of humanity’s dream to create artificial life --- the bronze giant Talos forged by Hephaestus, the clay Golem animated by sacred words, the philosophical speculations of Descartes and Leibniz about the nature of mind. Those myths and ideas were not merely fantasies; they were expressions of genuine intellectual longing, the desire to understand intelligence by attempting to replicate it.
Episode 2 picks up where those myths left off. For the dream of artificial life did not remain confined to legend and philosophy. Across the ancient, medieval, and Renaissance worlds, a series of extraordinary individuals --- engineers, inventors, artists, and craftsmen --- translated that dream into metal, wood, water, and rope. They built machines that moved, responded to their environment, performed sequences of actions, and in some cases could even be “programmed” to behave in different ways. These were automata: self-operating machines that simulated life without possessing it.
“Automata were humanity’s first experiments in programming behavior --- centuries before the word ‘computer’ existed.”
The word “automaton” comes from the Greek “autómatos,” meaning “acting of one’s own will” --- a description that captures something essential about these devices. An automaton is not merely a tool that extends human power, like a lever or a wheel. It is a machine that, once set in motion, operates according to its own internal logic, executing a sequence of actions without requiring a human hand to guide each step. In this sense, every automaton contains within it a rudimentary program: a set of instructions encoded in gears, cams, springs, or ropes that determine how the machine will behave.
This episode traces the history of automata from the workshops of ancient Alexandria to the courts of Renaissance Europe, examining the machines themselves, the engineering principles behind them, and the philosophical questions they raised. We will meet three pivotal figures: Hero of Alexandria, who built what may be the world’s first programmable machine; Al-Jazari, the medieval Islamic engineer whose automata rival anything produced in Europe for centuries; and Leonardo da Vinci, the Renaissance genius whose mechanical knight anticipated modern robotics by five hundred years. Together, their stories form a continuous thread leading from the ancient world to the threshold of modern computing.
Section 1: Hero of Alexandria --- The First Programmer
To find the earliest clear precursor of the modern computer, we must travel back nearly two thousand years, to the teeming intellectual metropolis of Alexandria in Roman Egypt. There, in the first century CE, worked a man whose imagination and technical ingenuity have rarely been equaled in the history of engineering: Hero of Alexandria, known to later ages as Hero Mechanicus, “Hero the Engineer.” Almost nothing is known of his personal life, but what survives is a remarkable body of written work --- treatises on pneumatics, mechanics, mathematics, and optics that reveal a mind of breathtaking scope, equally at home with abstract proofs and the practical challenges of building working machines.
The Aeolipile: Steam Power, Two Thousand Years Early
Hero’s most famous creation is the aeolipile, often described as the world’s first steam engine. A sealed metal sphere, mounted on a pivot, was fitted with two curved nozzles projecting from opposite sides. A boiler beneath heated water to produce steam, which rose into the sphere and escaped through the nozzles, creating a reaction force that caused the sphere to spin --- the same principle that drives modern jet engines and steam turbines. Hero presented it not as a practical power source but as a scientific demonstration, a proof that the physical world operated according to principles that could be understood, harnessed, and applied. It was, in the deepest sense, an experiment.
Hero lacked the material technology --- precision metalworking, high-pressure boilers, thermodynamic theory --- that would have been needed to harness steam for useful work. That achievement would wait sixteen centuries, for James Watt and the Industrial Revolution. But the aeolipile demonstrates something crucial about Hero’s mind: his ability to identify and exploit physical principles for novel ends, a quality that marks all the greatest engineers and inventors across history.
Automated Temple Doors: Engineering Wonder
Among the most theatrically spectacular of Hero’s inventions were his automated temple doors. The mechanism was elegantly conceived: a priest would light a sacred fire on an altar outside the temple. Heat from the fire would cause air in a sealed chamber beneath the altar to expand, forcing water through pipes into a hanging bucket. As the bucket filled and grew heavier, it would descend, pulling on ropes and chains connected to the doors’ pivot mechanisms, causing them to swing open as if by divine command. When the fire was extinguished, the air cooled, the water was siphoned back, and counterweights pulled the doors closed.
To worshippers who could not see the hidden mechanism, the effect was profound: the doors of the god’s house opened at the lighting of the sacred flame, as though the deity within were granting entry. Hero’s automaton was a tool for engineering human experience --- for creating wonder and reverence through mechanical means. This capacity to shape human perception through hidden mechanism anticipates, in a fascinating way, the modern field of human-computer interaction, where the complexity of the system is deliberately concealed to produce a seamless user experience.
Coin-Operated Holy Water Dispensers
Hero also described a device immediately recognizable to any modern reader: a coin-operated vending machine. A worshipper would insert a coin into a slot; the coin would fall onto a pivoting lever, depressing one end, lifting the other, and temporarily opening a valve to allow a measured quantity of holy water to flow into a basin below. As the coin slid off the lever, the valve would close again, cutting off the flow precisely.
This device demonstrates a concept central to all later computing: the conditional response. The machine does not run continuously; it responds to a specific input --- the coin --- by producing a specific output --- the water --- and then stops. Input, processing, output: the fundamental logic of the computer is present, in physical form, in Hero’s first-century Alexandria. The coin-operated holy water dispenser is not merely a clever mechanism; it is a working model of computational logic.
The Programmable Cart: The World’s First Computer Program?
Hero’s most extraordinary and far-sighted invention is the one least known to the general public: his programmable cart. Described in his treatise “On Automaton-Making,” this was a wheeled vehicle powered by a falling weight that, as it descended, would unwind a rope around the axle and set the cart in motion. What made it extraordinary was the mechanism for controlling direction.
The cart’s path was determined not by a human operator but by the pattern in which ropes were wound around the axle before the journey began. By winding ropes in specific configurations --- transferring drive between different axle sections at predetermined points --- Hero could make the cart travel forward, turn left or right, and execute complex paths involving multiple turns. The entire sequence of movements was encoded in the mechanical arrangement of the ropes, and crucially, this arrangement had to be made before the cart was set in motion.
“The path of Hero’s cart was not controlled moment-to-moment by a human hand. It was predetermined --- programmed --- by the physical arrangement of the ropes: the essential logic of every computer program ever written.”
This is the key insight that elevates the programmable cart above Hero’s other remarkable inventions. The operator specified what the machine was to do before the machine did it, encoding a sequence of instructions in a physical medium that the machine would then execute autonomously. This is precisely what a computer program is. Hero was not building a computer --- he lacked the electronic components that make modern computation possible --- but he had grasped the fundamental conceptual principle that underlies all computation, two millennia before it was formally theorized.
Reflection: Hero’s work marks the decisive leap from myth to engineering logic. His machines embodied principles --- conditional response, predetermined sequences, input-output logic --- that would not be fully formalized until the twentieth century. In Hero’s Alexandria, the idea of the machine as an executor of instructions was born.
Section 2: Al-Jazari --- The Engineer of Wonders
More than a thousand years separate Hero of Alexandria from our next great automaton builder, and those centuries were not idle ones. The torch of engineering inquiry, largely extinguished in Western Europe by the collapse of the Roman Empire, burned brightly in the Islamic world, where scholars translated, preserved, and extended the works of the Greek masters. It was in this tradition that there emerged, in the twelfth century, a figure whose technical achievement rivals anything produced in the ancient world: Ibn Ismail Ibn al-Razzaz Al-Jazari.
Al-Jazari was born around 1136 CE and spent most of his working life as chief engineer at the palace of the Artuqid rulers of Diyarbakir, in southeastern Anatolia. He served three successive rulers over twenty-five years, designing and building machines for the court. In 1206, at the request of his final patron, he completed the work for which he is remembered: “The Book of Knowledge of Ingenious Mechanical Devices” --- known in Arabic as “Kitab fi Ma’rifat al-Hiyal al-Handasiyya.”
The Book of Knowledge: A Landmark in Engineering History
Al-Jazari’s book is one of the most remarkable technical documents ever produced. It describes in meticulous detail fifty mechanical devices, organized into six categories: water clocks and candle clocks; vessels and figures for drinking sessions; vessels for hand-washing; fountains and musical automata; water-raising machines; and miscellaneous devices. Each device is described with a precision that would allow a skilled craftsman to reproduce it, and the book is illustrated with detailed diagrams and paintings that are themselves works of considerable artistic merit.
What distinguishes Al-Jazari from mere craftsmen is the level of mechanical understanding his work reveals. He was not simply building existing devices to higher standards; he was inventing new mechanical principles and solving engineering problems in genuinely novel ways. Among his documented innovations are the crank mechanism for converting reciprocal motion to rotary motion, laminated wooden construction for water-raising machines, and the double-acting pump --- all technologies that would later appear, independently or otherwise, in European engineering. Al-Jazari was not a craftsman who happened to write; he was a systematic engineer whose documentation represents the first clear step toward a genuine science of mechanical design.
Water Clocks: Timekeeping as Theater
Al-Jazari’s most celebrated creations are his water clocks, which elevate the ancient technology of clepsydrae to a level of complexity and theatrical splendor never before achieved. His elephant clock, perhaps the most famous, was a multi-cultural tour de force: mounted on the back of an elephant (representing India), it incorporated a Chinese dragon, an Egyptian phoenix, and Arabic writing --- integrating the iconography of the great civilizations of the medieval world into a single working mechanism.
The elephant clock worked by a beautifully conceived chain of mechanical causation: a float chamber within the elephant’s body contained a bowl with a small hole, which slowly filled with water and sank. Every half-hour, the sinking bowl would pull a string, releasing a ball bearing from the dragon’s mouth; the ball would strike a cymbal, the phoenix would rotate, and a human figure would point to the current hour. The mechanism would then reset automatically for the next cycle. The entire sequence --- timing, triggering, display, reset --- was executed without any human intervention, driven entirely by the patient flow of water.
The castle clock, another masterwork, was even more elaborate: a large facade depicting a castle with moving musicians, doors that opened to reveal the current hour, and an astronomical display showing the positions of the sun and moon. It was a mechanical theater that also happened to tell the time --- a machine that unified artistic spectacle with practical utility in a way that would not be equaled until the great cathedral clocks of medieval Europe.
Hand-Washing Automata: Machines That Serve
Not all of Al-Jazari’s creations were conceived for courtly spectacle. Some were designed for practical daily use. Islamic law prescribes ritual hand-washing before prayer, and Al-Jazari designed mechanical servants to facilitate this practice with an elegance that blended function and artistry. His most sophisticated hand-washing device took the form of a mechanical female figure standing beside a basin. When a person activated a trigger, the figure would pour water from a pitcher, provide a comb and towel for the user’s convenience, and finally drain the used water away --- all through a sequence of mechanical actions driven by the flow of water through concealed chambers and channels. The figure moved her hands and turned her head during this sequence, creating the convincing appearance of a human servant.
These hand-washing automata are particularly interesting from the perspective of AI history because they were explicitly designed to simulate human service --- to stand in for a human assistant in a way that was practically useful rather than merely entertaining. The question of what it means for a machine to “serve” a human being, a question now central to the design of modern AI assistants and service robots, is already implicit in Al-Jazari’s twelfth-century workshop.
The Musical Boat: Proto-Programming in the Twelfth Century
Perhaps Al-Jazari’s most technologically significant creation is his programmable musical boat: a miniature vessel, designed to float on a pool at a party or gathering, carrying four mechanical musicians --- a harpist, a flautist, and two drummers --- who would play continuously as the boat moved across the water. The remarkable feature was that the rhythmic patterns they played could be varied by adjusting the mechanism before launch.
The key element was a rotating cylinder inside the hull, studded with small pegs arranged in specific patterns. As the cylinder rotated, the pegs would strike levers connected to the musicians’ arms, causing them to play in the corresponding rhythm. By changing the arrangement of the pegs --- adding, removing, or repositioning them --- a different rhythmic pattern could be encoded into the device before it was set afloat. The cylinder was the world’s first musical program: a physical encoding of a sequence of instructions that the machine would execute autonomously, without further human intervention.
“Al-Jazari’s peg cylinder is a direct ancestor of the music box, the player piano, the Jacquard loom, and ultimately the punch-card programs of the early computer era.”
The peg-cylinder mechanism did not stop with Al-Jazari. The same principle reappears in the music boxes of eighteenth-century Europe, the barrel organs of the nineteenth century, the Jacquard loom (whose punch cards directly inspired Babbage’s analytical engine), and ultimately the punched paper tape and cards of early electronic computers. Al-Jazari’s musical boat stands at the head of a technological lineage that leads, through many intermediate steps, to the modern digital computer.
Reflection: Al-Jazari’s automata represent a level of mechanical sophistication that foreshadowed modern robotics with remarkable clarity. His peg-cylinder programming mechanism, his conditional-response water clocks, and his functionally useful hand-washing servants show an engineer who understood not just how to build machines, but how to make machines do things --- a distinction that anticipates the entire history of software.
Section 3: Renaissance Clockwork and Leonardo da Vinci
By the fifteenth century, the center of automaton-building had shifted to Europe. The mechanical clock, first developed there in the thirteenth century, had given craftsmen a set of precision engineering techniques --- fine gear cutting, escapement mechanisms, spring making --- that made increasingly sophisticated automata possible. Courts across the continent competed to display mechanical marvels as symbols of power and cultural refinement. And in this milieu of competitive display and technical virtuosity, there emerged the greatest automaton designer of the Renaissance: Leonardo da Vinci.
The Mechanical Knight: A Robot Before Its Time
Around 1495, in the service of Ludovico Sforza, Duke of Milan, Leonardo da Vinci designed what may be the most sophisticated automaton of the pre-modern era: a mechanical knight. Preserved in sketches in Leonardo’s extraordinary notebooks, the knight was an armored humanoid figure driven by a complex system of cables, pulleys, and gears concealed within its torso. According to the evidence of the notebooks and subsequent modern reconstructions, the knight could perform several distinct actions: it could sit and stand, move its arms at the shoulder and elbow, turn its head, and open and close an armored visor on its helmet.
In 2002, NASA robotics engineer Mark Rosheim undertook a detailed study of Leonardo’s notebooks and constructed a working replica, demonstrating that the design was mechanically sound and functioned as Leonardo had apparently intended. The mechanical knight was probably designed as entertainment for courtly banquets and festivities. But its significance runs deeper than spectacle. It was a humanoid robot --- a machine explicitly designed in the form of a human being to replicate a range of human physical capabilities. The engineering challenges Leonardo faced --- how to transmit force through flexible joints, how to sequence multiple simultaneous movements, how to produce organic-seeming motion from mechanical parts --- are precisely the challenges that confront robotics engineers today.
The Mechanical Lion: Art, Engineering, and Diplomacy
A second Leonardo automaton, even more famous in its own time, was the mechanical lion he designed, probably around 1515, reportedly as a gift for the French king Francis I. According to contemporary descriptions, the lion could walk several paces forward under its own power, then stop and open its chest to reveal a cavity filled with lilies --- the symbol of the French royal house --- thus delivering a sophisticated political message through automated theatrical performance.
The mechanical lion illustrates a dimension of automaton-building easy to overlook if we focus only on engineering: the use of automata as instruments of political communication. A mechanical lion presenting lilies to a king was not merely a curiosity; it was a carefully crafted diplomatic gesture, using the theater of mechanism to convey a message about the relationship between its creator and its recipient. Leonardo understood that the most powerful machines are those that engage human emotions and imagination --- an insight that would not be out of place in a contemporary discussion of AI and user experience design.
Cathedral Clocks: A Mechanical Cosmos
While Leonardo’s automata represent the highest individual achievements of Renaissance engineering, they existed within a broader culture of clockwork wonder that found its grandest public expression in the great astronomical clocks of European cathedrals. Of these, the most celebrated is the astronomical clock of Strasbourg Cathedral, whose history stretches across seven centuries of development. The first Strasbourg clock, built around 1352, featured a mechanical rooster that crowed and flapped its wings at noon --- an automaton so impressive it became famous across Europe. Successive rebuilds added the Three Magi, planetary dials, and increasingly elaborate astronomical displays. The current clock, completed in 1843, features hundreds of moving figures and an astronomical calendar accurate to the year 2500.
The Strasbourg clock and its counterparts in Bern and Prague were not merely technological achievements; they expressed a particular worldview. In medieval and Renaissance cosmology, the universe itself was a great clock --- a mechanism set in motion by God, operating according to fixed and comprehensible laws. To build a machine that mirrored the movements of the heavens was to participate in the divine act of creation, to demonstrate that human reason could grasp and replicate the logic of the cosmos. This is a profound and surprisingly modern ambition: understanding the universe by modeling it.
Reflection: Renaissance automata were both art and science --- objects at the intersection of aesthetic ambition and engineering achievement. In building machines that moved like living things, Leonardo and his contemporaries were not merely displaying craftsmanship. They were exploring the deepest questions about the relationship between mechanism and life, pushing the technology of their time to its absolute limits.
Section 4: Automata as Precursors to AI
Having traced the history of automaton-building from Hero’s workshop in Alexandria to Leonardo’s studio in Milan, we can now ask: what do these machines actually tell us about the history of artificial intelligence? What connects the programmable cart of Hero, the musical boat of Al-Jazari, and the mechanical knight of Leonardo to the AI systems of the twenty-first century?
Programmability: The Key Concept
The most important concept linking automata to AI is programmability. A simple mechanism --- a water wheel, a windmill, a catapult --- does one thing, always the same way. An automaton, in the sense we have been exploring, is different: its behavior can be varied by configuring it in different ways before operation. Hero’s cart could follow different paths by rearranging the ropes. Al-Jazari’s musical boat could play different rhythms by rearranging the pegs. This is the essential concept of programming: separating the specification of behavior from the mechanism that executes it.
This separation is what makes computation possible. A computer is not a machine that does a specific thing; it is a machine that does whatever its program specifies. The history of computing is, at one level, the history of successive refinements of this idea --- from the peg cylinders of Al-Jazari, to the punch cards of Jacquard and Babbage, to the paper tape of early electronic computers, to the stored-program architecture of the modern digital computer. At each stage, the principle is the same: encode the desired behavior in some medium, and let the machine read and execute that encoding.
Repeatability and Reliability
A second key concept demonstrated by automata is repeatability. A human performer will vary their performance each time they perform --- shaped by mood, fatigue, and attention. An automaton executes the same sequence every time it is activated, with a consistency no human can match. This determinism is both the great strength and the great limitation of mechanical automata and, by extension, of early computers. It means the machine is perfectly reliable within its designed domain but cannot adapt, learn, or respond to situations its designer did not anticipate.
The history of AI is, in large part, the history of attempts to overcome this limitation: to create machines that can respond flexibly to novel situations, that can, in some sense, go beyond their programming. The tension between the repeatability of mechanism and the adaptability of intelligence is one of the deepest themes in the entire history of computing. The automata builders were the first to encounter it.
The Philosophical Question: Behavior Versus Understanding
Automata also raised, with inescapable vividness, a philosophical question that has never been fully resolved: is lifelike behavior sufficient to constitute intelligence? When Al-Jazari’s hand-washing automaton poured water with the appearance of a human servant, was it “serving” in any meaningful sense? When Leonardo’s knight moved its arms and turned its head, was it, in any sense, a knight? The question seems almost trivial when posed about mechanisms of wood and metal. It becomes far less trivial when posed about digital systems that can engage in sophisticated conversation, recognize faces, compose music, and diagnose diseases.
“The question the automata raised --- is lifelike behavior enough to count as intelligence? --- remains the central question of AI philosophy today.”
The philosopher who most influentially addressed this question in the twentieth century was Alan Turing, whose 1950 paper “Computing Machinery and Intelligence” proposed that a machine should be considered intelligent if its behavior was indistinguishable from that of an intelligent human. This “Turing Test” is, in a sense, a modern formalization of the question that automaton builders had been implicitly raising for two thousand years. When a medieval crowd watched the mechanical rooster of Strasbourg crow at noon, they were performing an informal Turing Test: does this behavior convince us? Does it feel like intelligence? The automaton passed.
Conclusion: The First Steps Toward Artificial Intelligence
We began this episode with the claim that automata were humanity’s first experiments in programming behavior, centuries before computers. Having traced the history from Hero’s Alexandria to Leonardo’s Milan, we can assess that claim precisely. The automata we have examined were not computers; they lacked the flexibility, the generality, and the speed that define modern computation. But they embodied the key conceptual insights that make computing possible: that behavior can be encoded in a physical medium and executed by a machine; that complex outputs can arise from the interaction of simple mechanical rules; that a machine can be programmed before operation to behave in ways its operator specifies.
Hero of Alexandria grasped the principle of the program two thousand years before Turing formalized it. Al-Jazari built what may be the world’s first sequencer more than eight centuries before the first electronic sequencer appeared. Leonardo da Vinci faced the engineering challenges of humanoid robotics five centuries before Asimo took its first steps. These were not mere curiosities or entertainment devices. They were genuine intellectual achievements, steps in a long and continuous project of understanding intelligence by attempting to replicate it.
“The automata builders bridged myth, philosophy, and engineering. In wood, metal, and water, they gave physical form to humanity’s oldest and most audacious ambition.”
Automata also bridged the worlds of myth and philosophy with the world of engineering. The myths of Episode 1 expressed desires and raised questions. The philosophical tradition of Descartes, Leibniz, and Hobbes, which we will examine in Episode 3, provided conceptual frameworks for thinking about those questions. But automata were different: they were physical embodiments of the questions themselves, machines that forced their creators and audiences to confront, in tangible form, the relationship between mechanism and life, between programmed behavior and genuine intelligence.
The history of automata is not a footnote to the history of AI. It is the first chapter --- the chapter in which the fundamental ideas were worked out in wood and metal and water, long before anyone had thought of electricity or silicon. Understanding that history is essential to understanding where artificial intelligence comes from, and, perhaps, where it is going.
───
Next in the Series: Episode 3
The Philosophers of Mind --- Descartes, Leibniz, and Hobbes
The automata builders showed that machines could behave like living things. But could a machine actually think? In Episode 3, we turn to the philosophers who dared to ask that question directly. René Descartes argued that the human body is a machine --- but that a mind could never be replicated mechanically. Gottfried Leibniz dreamed of a universal language of logic in which all reasoning could be reduced to calculation. Thomas Hobbes declared, with characteristic bluntness, that reason is nothing but reckoning. Together, these three thinkers laid the philosophical foundations upon which modern AI would eventually be built. Their arguments are still alive in the debates of cognitive science and philosophy of mind today.
--- End of Episode 2 ---