Let $X$ be an algebraic stack and $\mathcal{A}$ a quasi-coherent $\mathcal{O}_X$-algebra. Define the stack $\mathrm{Spec}(\mathcal{A})$ by
$\mathrm{Spec}(\mathcal{A})(T) := \{(f,h) : f \in X(T), h \in \hom_{\mathrm{Alg}(\mathcal{O}_T)}(f^* \mathcal{A},\mathcal{O}_T)\}$
and the obvious restriction maps. Is it true that $\mathrm{Spec}(\mathcal{A})$ is an algebraic stack? Do you know a reference? I cannot even prove that the diagonal is representable. Perhaps first the case of an algebraic space has to be done. Note that if $X$ is a scheme, this coincides with the usual definition of the spectrum as in EGA I.