Have a look here:Admin Panel -> Staff -> Departments -> Select a department, e.g. "Support" -> Enable/Activate the following:Ticket Assignment:
Restrict ticket assignment to department members
This way tickets can only be assigned to other agents if they are in the same department.