  We make use of the cotangent complex formalism developed by Lurie to
formulate Quillen cohomology of algebras over an operad in a general base
category. Moreover, using the same machinery, we introduce a spectral
Hochschild cohomology theory for enriched operads and algebras over them. We
prove further that both the Quillen and Hochschild cohomologies of algebras
over an operad can be controlled by the corresponding cohomologies of the
operad itself. When passing to the category of simplicial sets, we assert that
both these cohomology theories for operads, as well as their associated
algebras, can be calculated in the same framework of spectrum valued functors
on the twisted arrow $\infty$-category of the operad of interest. This
assertion allows us to establish a connection between Hochschild and Quillen
cohomologies of simplicial operads. Additionally, we formulate the Quillen
principle for $E_n$-algebras in simplicial sets, which provides a convenient
fiber sequence relating the Hochschild and cotangent complexes of such objects.
This determines an unstable-analogue of a significant result obtained by
Francis and Lurie. Our strategy introduces a novel perspective, focusing solely
on the intrinsic properties of the twisted arrow $\infty$-categories of
operads.
