Handle new and existing agent Ids