  We discuss how the Hochschild cohomology of a dg category can be computed as
the trace of its Serre functor. Applying this approach to the principal block
of the Bernstein--Gelfand--Gelfand category $\mathcal{O}$, we obtain its
Hochschild cohomology as the compactly supported cohomology of an associated
space. Equivalently, writing $\mathcal{O}$ as modules over the endomorphism
algebra $A$ of a minimal projective generator, this is the Hochschild
cohomology of $A$. In particular our computation gives the Euler characteristic
of the Hochschild cohomology of $\mathcal{O}$ in type A.
