Hi Colin.
I used to execute a sql statement like this one:
select OH_Name from ah,oh where AH_OType='HOST' and AH_OH_Idnr=OH_Idnr and AH_TimeStamp4='NULL'
NULL as this timestamp means that the agent has not ended. So, this statement will return all the "active" agents. I'm not sure that's a 100% errorfree solution but you can use this on a SQLI vara and compare with the UC_EX_HOSTCHAR (contains the name of all your agents) vara. But I was not able to find the table/field that stores the client definitions for the agents. By default, the agents belong all to the client 0.
Hope this helps.