The assembly of pili on the cell wall of Gram-positive bacteria requires transpeptidase enzymes called sortases. In Streptococcus agalactiae, the PI-1 pilus island of strain 2603V/R encodes two pilus-specific sortases (SrtC1 and SrtC2) and three pilins (GBS80, GBS52 and GBS104). Although either pilus-specific sortase is sufficient for the polymerization of the major pilin, GBS80, incorporation of the minor pilins GBS52 and GBS104 into the pilus structure requires SrtC1 and SrtC2, respectively. The S. agalactiae housekeeping sortase, SrtA, whose gene is present at a different location and does not catalyze pilus polymerization, was shown to be involved in cell wall anchoring of pilus polymers. To understand the structural basis of sortases involved in such diverse functions, we determined the crystal structures of S. agalactiae SrtC1 and SrtA. Both enzymes are made of an eight-stranded beta-barrel core with variations in their active site architecture. SrtA exhibits a catalytic triad arrangement similar to that in Streptococcus pyogenes SrtA but different from that in Staphylococcus aureus SrtA. In contrast, the SrtC1 enzyme contains an N-terminal helical domain and a 'lid' in its putative active site, which is similar to that seen in Streptococcus pneumoniae pilus-specific sortases, although with subtle differences in positioning and composition. To understand the effect of such differences on substrate recognition, we have also determined the crystal structure of a SrtC1 mutant, in which the conserved DP(W/F/Y) motif was replaced with the sorting signal motif of GBS80, IPNTG. By comparing the structures of WT wild type SrtA and SrtC1 and the 'lid' mutant of SrtC1, we propose that structural elements within the active site and the lid may be important for defining the role of specific sortase in pili biogenesis.