Black or purple wasps are either soldier flies which are the adults of the commonly-seen compost maggot or mud daubers. Neither sting and both are highly beneficial. Soldier fly maggots help break down compost and mud daubers kill spiders. Mud daubers most common victims are the black widow spiders. Soldier flies can’t sting and the mud dauber females only sting if grabbed. So don’t do that!