These are Braconid wasps. Braconids are small, parasitic wasps that lay their eggs on moth caterpillars. The wasp larvae, when they hatch, burrow into the caterpillar and start eating it. The caterpillar soon stops eating. When they're ready to pupate, the wasp larvae cut holes in the caterpillar's skin, emerge, and make the cocoons that you saw. The caterpillar always is killed in the process, either during or shortly after the wasp pupation - a perfect example of biological pest control!


