Lem was very interested in the issue of the nature of an ideal society: compare his Peace on Earth, The Futurological Congress and Observation on the Spot.
The Highest Possible Level of Development civilization. A gravely injured hermit comes to Trurl's house and tells Trurl of Klapaucius's adventure: Klapaucius wanders across an old robot, who tells him that he has logically deduced the existence of a civilization that reached the highest possible level of development (hence "HPLD"). He has inferred the existence of such a civilization by figuring that if there are different stages of development, there will be one that is the highest. He was then faced with a problem of identifying that one; as he noted, everyone claimed that theirs was the HPLD.
Upon much research and thought, he decided that the only way to find it is by looking for a "wonder", i.e. something that has no rational explanation. Eventually Klapaucius discovers one such wonder: a star in the shape of a cube, orbited by a planet also shaped like a cube with the huge letters HPLD written on it. He lands and meets its inhabitants: a group of about 100 individuals lying around doing nothing. When the HPLDs grow tired with Klapaucius's efforts to extract answers from them, they teleport him and his ship far into outer space, albeit after filling the ship with gifts.
Seeing how he will not get anywhere this way, Klapaucius constructs a massive machine capable of simulating the entire universe, including a member of the HPLD civilization. Upon questioning the simulation, he is informed that over six million such interrogations took place in the past. The simulation also reveals that the civilization in question has long since achieved the HPLD, and thus has nothing else to strive for.
When Klapaucius asks why the HPLD civilization does not continuously engage in helping other, less advanced civilizations, the simulation explains that their attempts to do so in the past have proven extremely counter-productive. For instance, having dropped some millions of wish-fulfilling devices on a planet, they saw it blow up in a matter of hours. Eventually, the HPLD representative provides Klapaucius with the formula for "Altruizine" – a substance that allows individuals within a limited area to completely share all feelings and emotions, including both pain and joy. The idea behind Altruizine is that people who feel each other's pain as their own should treat each other as they would themselves.
Altruizine. Klapaucius produces a large quantity of the substance and sends the above-mentioned hermit (who is eager to help others) in human guise to experiment on the population of a single planet. Some of the results include villagers feeling the birth pains of a cow, depressed people being violently attacked and driven off and a crowd storming the house of the newlyweds to vicariously participate in their unaccustomed sensations.
Eventually, the hermit is identified for a robot (because he does not feel the humans' pain), is thoroughly beaten and tortured, then shot into outer space via a cannon. He then lands near Trurl's house, where the story began. Concluding his tale, the hermit assures Trurl that his thirst for altruism has vanished.
Trurl and the construction of happy worlds. Trurl is not deterred by the cautionary tale of altruizine and decides to build a race of robots happy by design. His first attempt are a culture of robots who are not capable of being unhappy (e.g. they are happy if seriously beaten up). Klapaucius ridicules this. Next step is a collectivistic culture dedicated to common happiness. When Trurl and Klapaucius visit them, they are drafted by the Ministry of Felicity and made to smile, sing, and otherwise be happy, in fixed ranks (with other inhabitants).
Trurl annihilates both failed cultures and tries to build a perfect society in a small box. The inhabitants of the box develop a religion saying that their box is the most perfect part of the universe and prepare to make a hole in it in order to bring everyone outside the Box into its perfection, by force if needed. Trurl disposes of them and decides that he needs more variety in his experiments and smaller scale for safety.
He creates hundreds of miniature worlds on microscope slides (i.e. he has to observe them through a microscope). These microworlds progress rapidly, some dying out in revolutions and wars, and some developing as regular civilizations without any of them showing any intrinsic perfection or happiness. They do achieve inter-slide travel though, and many of these worlds are later destroyed by rats.
Eventually, Trurl gets tired of all the work and builds a computer that will contain a programmatic clone of his mind that would do the research for him. Instead of building new worlds, the computer sets about expanding itself. When Trurl eventually forces it to stop building itself and start working, the clone-Trurl tells him that he has already created lots of sub-Trurl programs to do the work and tells him stories about their research (which Trurl later finds out is bogus). Trurl destroys the computer and temporarily stops looking for universal happiness.
Note that the last section of the story, does not appear in Michael Kandel's English translation of The Cyberiad, and neither does in Italian translation.