  A Tannakian category is an abelian tensor category equipped with a fiber
functor and additional structures which ensure that it is equivalent to the
category of representations of some affine groupoid scheme acting on the
spectrum of a field extension. If we are working over an arbitrary commutative
ring rather than a field, the categories of representations cease to be
abelian. We provide a list of sufficient conditions which ensure that an
additive tensor category is equivalent to the category of representations of an
affine groupoid scheme acting on an affine scheme, or, more generally, to the
category of representations of a Hopf algebroid in a symmetric monoidal
category. In order to do this we develop a "formal theory of Tannaka duality"
inspired by Ross Street's "formal theory of monads." We apply our results to
certain categories of filtered modules which are used to study p-adic Galois
representations.
