Pi’s loop stops after a tool batch only when every result in the batch sets the terminate flag. A single tool cannot unilaterally end the session — termination requires consensus, which prevents one misbehaving or over-eager tool from cutting off work the other tools in the batch still need.
Related: