A typical use of the <sage> tag is to include an <input> element, followed by an <output> element. The content of the <input> element may be presented statically in PDF output, or dynamically as a Sage Cell in an output format based on HTML. Of course, for output as a CoCalc worksheet, the Sage code is presented in the worksheet's native format.
The content of the <output> element is included in PDF output, but not in dynamic instances, since it can be re-computed. Notably, there is a conversion which pairs input and output into a single file in the format used by Sage's doctest framework. So if expected output is provided, it becomes automatic to identify when Sage has diverged from your expectations, and you can adjust your examples accordingly.
The Sage Cell Server can also be configured to interpret different languages, because Sage by default contains everything needed to evaluate code in these languages. This is done by providing a @language attribute, where possible values are sage, gap, gp, html, maxima, octave, python, r, and singular. The default is sage.