better event handling on agent create