Playing marbles would be a kid’s game, so an older person playing (and being good at it), is the joke. Agate is a mineral that some marbles were made of. “Dibs” was slang for marbles, from the ancient game of dibstones. Calling out “Dibs” was an exclamation used to declare one’s right to marbles knocked outside the circle of play, and is used now to generally claim rights to something. “Playing for keeps”, meant that you got to keep the marbles you won, rather than returning them to the original owner after the end of game. Now the term commonly refers to “a serious situation”. It would be serious for a child if you potentially “lost your marbles,” which now can mean “going insane“. Now, the phrase can be shortened to “losing it”.