The dyeing of agate was industrialised at Idar-Oberstein in Germany in the nineteenth century and the methods have barely changed: soak the stone in a metal salt or organic dye solution, sometimes for weeks, then heat or treat it chemically to fix the colour in the porous layers. Blue comes from iron cyanides, green from chromium or nickel, black from sugar and sulphuric acid.
The result is genuine agate with added colour, and it is a legitimate product. The problem is only ever the description. A vivid blue agate slice sold as 'natural blue agate' is misdescribed; sold as dyed agate, it is exactly what it says.
Identifying it takes one look at the band structure. Dye penetrates the porous bands and not the dense ones, so a dyed slice typically alternates between intensely coloured layers and nearly white ones, with unnaturally high contrast. Natural agate's bands differ in tone but stay within the muted natural palette.