Generalize agent query test to handle ad-hoc groups and single agents, add additional asyncTest element for single agent queries