\ifx\conditionmacro\undefined
  \immediate\write18{%
    pdflatex "\gdef\string\conditionmacro{1} \string\input\space\jobname"
  }%
  \immediate\write18{%
    sage "\jobname.sagetex.sage"
  }%
  \immediate\write18{%
    pdflatex "\gdef\string\conditionmacro{2} \string\input\space\jobname"
  }%
  \expandafter\stop
\fi

\documentclass[DIV16]{scrartcl}

\usepackage{sagetex}

\begin{document}

We silently define a matrix.

\begin{sagesilent}
A=matrix(QQ,2,2,[[1,2],[3,4]])
\end{sagesilent}

I am talking about the matrix
\[ A = \sage{A} \]

which has the inverse
\[ A^{-1} = \sage{A^-1} \]

\end{document}