In Greek mythology, Agamedes (Ancient Greek Ἀγαμήδης) is the Minyan architect of Orchomenus, usually son of Erginus and brother (or associate) of Trophonius. With Trophonius he builds Apollo's temple at Delphi and a booby-trapped treasury; trapped in the king's snare, he is beheaded by his brother so their guilt will not be revealed. Distinct from Agamedes son of Stymphalus in Arcadia.
Adapted from Wikipedia, "Agamedes" · CC BY-SA 4.0
I.Builders and the Delphi reward
Common genealogy makes Agamedes and Trophonius sons of Erginus of Orchomenus; variants give Apollo, Zeus, or Stymphalus as father, or make Trophonius Apollo's son and Agamedes' stepson. As architects they build temples and palaces, above all Apollo's temple at Delphi. A Pindaric tradition says they asked the god for the best reward for men; after seven days (three in Cicero) they were found dead in their beds — linked to the proverb that those the gods love die young.
II.Treasury of Hyrieus
Pausanias' main tale has them build a treasury for Hyrieus of Hyria (or, in other versions, for Augeas) with one stone removable from outside. They repeatedly steal from it while seals stay intact. The king sets traps; Agamedes is caught, and Trophonius cuts off his head to prevent identification. The earth swallows Trophonius; at Lebadeia the pit of Agamedes stands by Trophonius' oracle, and inquirers sacrifice a ram invoking Agamedes before descending.
Pausanias also knows an Arcadian Agamedes son of Stymphalus — a different royal stem. The atlas id agamedes-orchomenus is the Orchomenian builder beside Trophonius.