Being trained by the Assassins' Guild in Ankh-Morpork did not fit Teppic for the task assigned to him by fate. He inherited the throne of the desert kingdom of Djelibeybi rather earlier than he expected (his father wasn't too happy about it either), but that was only the beginning of his problems...
Young Pteppic has been in training at the Assassins Guild in Ankh-Morpork for several years. The day after passing his final exam he somehow senses that his father has died and that he must return home. Being the first Djelibeybian king raised outside the kingdom leads to some interesting problems, based on the fact that Dios, the high priest, is a stickler for tradition, and does not, in fact, allow the pharaohs to rule the country (he earnestly believes that such mundane tasks are beneath them).
After numerous adventures and misunderstandings, Pteppic is forced to escape from the palace, along with a handmaiden named Ptraci (pronounced Traci). Meanwhile, the massive pyramid being built for Pteppic's father warps space time so much that it "rotates" Djelebeybi out of alignment with the space/time of the rest of the disc by 90 degrees. Pteppic and Ptraci travel to Ephebe to consult with the philosophers there as to how to get back inside the Kingdom. Meanwhile, pandemonium takes hold in Djelibeybi, as the kingdom's multifarious gods descend upon the populace, and all of Djelibeybi's dead rulers come back to life.
Eventually, Pteppic re-enters the Kingdom and attempts to destroy the Great Pyramid, with the helps of all of his newly resurrected ancestors. They are confronted by Dios, who, it turns out, is as old as the kingdom itself, and has advised every pharaoh in the history of the Kingdom. Dios hates change and thinks Djelibeybi should stay the same. Pteppic succeeds in destroying the Pyramid, returning Djelibeybi to the real world and sending Dios back through time (where he meets the original founder of the Kingdom, thereby re-starting the cycle). He then abdicates, allowing Ptraci (who turns out to be his half sister) to rule. Ptraci immediately institutes much-needed changes.
Pyramids is almost totally disconnected from the rest of the series. It has only five characters who appeared in later books: Death, Xeno and Ibid (they only appear in Small Gods, the only novel more distanced from the series than this one), Princess Keli (who is mentioned in Soul Music and the earlier novel Mort) and Dr. Cruces, who appears in Men at Arms.
Pyramids also takes place in a completely new country which has yet to be visited again, although it is referenced in Small Gods as the country of origin of one of the 'commanders' of the fleet that invaded Omnia. The commander was one who "considered himself to always be in charge of everything", despite being the admiral of the small Djelibeybian fleet from a country mostly underwater during the floods which is also the smallest country on the continent of Klatch.
Carpe Jugulum does reference the design on the staff of Dios, the High Priest, as one of the many designs the Count inoculates his children to.
There is also a reference in Small Gods to a religious philosopher named Koomi, but it says that he is from Smale. It is unknown if he has any connection with Koomi the priest.