A parasitoid wasp, Bathyplectes anurus, is a successful biocontrol agent against the alfalfa weevil, a pest of beneficial fabaceous plants such as alfalfa and chinese milk vetch. One of the possible reasons for the success in hot climates may be the ability of the cocooned larvae of this wasp to repeatedly jump and roll until they relocate themselves away from detrimental sunlight and heat. It is not yet known which wavelengths of light trigger the larval avoidance behavior, and microstructure of the cocoon shell that should allow light transmission. Here, the response of the cocooned larvae to different wavelengths, and the microstructure, hardness and elemental components of the cocoon shell were studied. A population of cocooned larvae were introduced on the boundary line between illuminated and shaded areas with blue, green, red, or near-infrared light-emitting diodes. The cocoons moved away from the blue and green light. The distance from the boundary to the cocoons in the shaded area was longer under these long wavelengths, followed by the red light and shortest under the near-infrared light and nil under darkness. No difference was found in mortality between different wavelengths after three days of illumination. Scanning electron microscope observations of the surface of the cocoon shell revealed that the belt-like middle ridge was porous with fibers, which likely allows ventilation and light transmission. The ridge and main body showed similar elemental composition, except that the ridge contained higher proportions of sulfur and calcium and was 1.9 times harder than the main body.