How do i destroy entity in mass ai

Ok so im trying to destroy entities from code by adding a tag so a destroy processor handles the destruction, but it causes my other processors to crash due to going out of index when one of them adds a tag despite making it a requirement not to loop over the entities if it has that tag
Any examples would be helpful i assume its to due with the context amount not updating the amount of entities or the update is happening while still looping