Currently, the only way for getting a sorted client from sorter is through:
This sorts all the active clients in the tree and returns all of them in a single vector. This is inefficient if the callers end up only needing a few of clients (e.g. when allocating one agent, only one or a few roles are allocated).
We could refactor the interface to return an iterator-like handle and then callers can query the next the client in the sorting order. This would pave the way for lazy sorting (i.e. only get the nth client) and improve performance.