We show that categories of modules over a ring in homotopy type theory (HoTT) satisfy the internal versions of the AB axioms from homological algebra. The main subtlety lies in proving AB4, which is that coproducts indexed by arbitrary sets are left-exact. To prove this, we replace a set X with the strict category of lists of elements in X. From showing that the latter is filtered, we deduce left-exactness of the coproduct. More generally, we show that exactness of filtered colimits (AB5) implies AB4 for any abelian category in HoTT. Our approach is heavily inspired by Roswitha Harting’s construction of the internal coproduct of abelian groups in an elementary topos with a natural numbers object. To state the AB axioms, we define and study filtered (and sifted) precategories in HoTT. A key result needed is that filtered colimits commute with finite limits of sets. This is a familiar classical result but has not previously been checked in our setting. Finally, we interpret our most central results into an
$\infty$
-topos
$ {\mathscr{X}} $
. Given a ring R in
$ {\tau_{\leq 0}({{\mathscr{X}}})} $
– for example, an ordinary sheaf of rings – we show that the internal category of R-modules in
$ {\mathscr{X}} $
represents the presheaf which sends an object
$ X \in {\mathscr{X}} $
to the category of
$ (X{\times}R) $
-modules in
${\mathscr{X}} / X$
. In general, our results yield a product-preserving left adjoint to base change of modules over X. When X is 0-truncated, this left adjoint is the internal coproduct. By an internalisation procedure, we deduce left-exactness of the internal coproduct as an ordinary functor from its internal left-exactness coming from HoTT.