Wikipedia
In Greek mythology, Agamedes (, Agamēdēs) was a son of Erginus (or, according to some traditions, the son of Stymphalus and grandson of Arcas). He was father of Cercyon by Epicaste, who also brought to him a stepson, Trophonius, who was by some believed to be a son of Apollo. According to others, Agamedes was a son of Apollo and Epicaste, or of Zeus and Iocaste, and father of Trophonius. In the most common accounts, Trophonius was his brother.
The two brothers are said to have distinguished themselves as architects, especially in building temples and palaces. They built Apollo's temple housing the oracle of Delphi. A tradition mentioned by Cicero states that Agamedes and Trophonius, after having built this temple, prayed to the god to grant them in reward for their labor what was best for men. The oracle told the brothers to do whatsoever they wished for six days and, on the seventh, their greatest wish would be granted. They did and were found dead on the seventh day. The saying "those whom the gods love die young" comes from this story.
They also built a treasury of Hyrieus, king of Hyria in Boeotia. The scholiast on Aristophanes gives a somewhat different account from Charax of Pergamum, and makes them build the treasury for King Augeas. The story about this treasury in Pausanias bears a great resemblance to that which Herodotus relates of the treasury of the Egyptian king Rhampsinitus. In the construction of the treasury of Hyrieus, Agamedes and Trophonius contrived to place one stone in such a manner that it could be taken away outside, and thus formed an entrance to the treasury, without anybody perceiving it. Agamedes and Trophonius constantly robbed the treasury; and the king, seeing that locks and seals were uninjured while his treasures were constantly decreasing, set traps to catch the thief. Agamedes caught in one of these snares, and Trophonius cut off his head to keep Agamedes's identity secret.
After this, Trophonius was immediately swallowed up by the earth. On this spot there was afterwards, in the grove of Lebadeia, the so-called cave of Agamedes, with a column by the side of it. Here also was the oracle of Trophonius, and those who consulted it first offered a ram to Agamedes and invoked him.
The question as to whether the story about the Egyptian treasury is derived from Greece, or whether the Greek story was an importation from Egypt, has been answered by modern scholars in both ways; but Müller has rendered it very probable that the tradition took its rise among the Minyans, was transferred from them to Augeas, and was known in Greece long before the reign of Psammetichus I, during which the intercourse between the two countries was opened.