When they’re being eaten, bean plants release chemicals that draw in parasitic wasps.

https://www.science.org/doi/10.1126/sciadv.aec3229

A plant immune receptor mediates tritrophic interactions by linking caterpillar detection to predator recruitment