This looks like an ichneumon wasp of some kind. There are 3,000 or so species in the family Ichneumonidae, some of which look confusingly similar and are hard to distinguish without very detailed examination. These are solitary living parasitic wasps which lay eggs in other invertebrates eg. caterpillars. The larvae feed on the unfortunate host when they hatch.