Wasps are very useful insects since they act as predators and prey on insects such as horn-worms and scale insects. These insects that they prey on cause great damage to plants such as tomatoes, oranges, tobacco. One example is the Encarsia Formosa, a wasp which controls white-fly in greenhouses.
Animals don't have a "purpose." This sort of question is religious, not scientific. Some Magic-believers think other species were "put here" for our benefit. This nonsense leads to torture and suffering for many animals at the hands of crazy people. Animals and plants evolve to survive, that's all. Just like us. Except they're not crazy.