Agates form in pockets of air in molten rock which has cooled. It is widely thought that silica in solution flows into those air pockets which are shaped like bubbles somewhat. The host rock is either porous or there is a channel. The silica rich solution evaporates leaving a microscopic layer of minerals which can be see under microscopes. The silica layers have trace elements which cause different colors like the red in many lake superior agates. Today the agates are exposed from their home in the cooled lava (often rhyolite) because they are very hard and the surrounding rock is worn away by the action of weather and wave, even glacial flows. I have one in my yard that was formed into a two hundred pound puddingstone which was formed by an alluvial flow and deposited in my region by the melting and receding glaciers. I am four hundred miles from lake superior.
Silica is SiO2. It is the most common of rocks. It forms quartz, flint, chert, jasper, chalcedony, agate and various gemstones. The different rocks it forms are due to differing conditions. They are all very hard. 7.0 on the mohs scale. Add a picture or two if you have them.