Sorry but we can’t ID these insects to species from the photo (not enough detail is visible), but they are the pupal stage of a beetle or weevil species. Many of these kinds of insects pass their pupal stage in the soil until they emerge as adults to start feeding, laying eggs, and producing the next generation. They are not likely beneficial organisms, but are more probably insects that could feed on plants. We recommend you dispose of them. If you know what plant(s) you had in the planter box, that might narrow down the possibilities as some beetles and weevils feed on particular plants, or types of plants; when the larva stage was ready to morph into the pupa stage, the larvae dropped and burrowed into the soil for this particular stage of metamorphosis.