We show that a Calabi–Yau structure of dimension d on a smooth dg category C induces a symplectic form of degree 2 – d on ‘the moduli space of objects’ MC. We show moreover that a relative Calabi–Yau structure on a dg functor C → D compatible with the absolute Calabi–Yau structure on C induces a Lagrangian structure on the corresponding map of moduli MD → MC.