A Pi-algebra A is a graded group with all of the algebraic structure possessed by the homotopy groups of a pointed connected topological space. We study the moduli space R(A) of realizations of A, which is defined to be the disjoint union, indexed by weak equivalence classes of CW-complexes X with pi(*) (X) = A, of the classifying space of the monoid of self homotopy equivalences of X. Our approach amounts to a kind of homotopical deformation theory: we obtain a tower whose homotopy limit is R(A), in which the space at the bottom is BAut(A) and the successive fibres are determined by H-algebra cohomology. (This cohomology is the analog for Pi-algebras of the Hochschild cohomology of an associative ring or the Andre-Quillen cohomology of a commutative ring.) It seems clear that the deformation theory can be applied with little change to study other moduli problems in algebra and topology. (C) 2003 Elsevier Ltd. All rights reserved.