\section*{A TikZ picture}
A finished TikZ box is saved to a tightly cropped PDF page, converted to
inline SVG, and placed back in the text with \TeX's metrics. It can go anywhere
a box can; here it is an automaton inside \texttt{align*}:
\begin{align*}
\begin{tikzpicture}[>=Stealth, baseline=(q0.base), thick]
\node[draw, circle] (q0) at (0,0) {$q_0$};
\node[draw, circle] (q1) at (2.4,0) {$q_1$};
\node[draw, circle, double] (q2) at (4.8,0) {$q_2$};
\draw[->, blue] (q0) -- node[above] {$a$} (q1);
\draw[->, blue] (q1) -- node[above] {$b$} (q2);
\draw[->, red] (q1) to[bend left=40] node[below] {$a$} (q0);
\end{tikzpicture}
\end{align*}
The same capture works for front ends such as \texttt{tikz-cd}, with no need
for PGF externalisation:
\begin{center}
\begin{tikzcd}[math mode=false]
$A^*$ \arrow[r, bend left, "$f$"] \arrow[r, bend right, "$g$"']
& $B^*$ \arrow[r, hookrightarrow, "$\iota$"] & $\mathbb{R}$
\end{tikzcd}
\end{center}