It's pretty easy, but you need to be able to view the Sybase tables via ODBC. The easist way is through MS Access. Once you get connected, attach the dbo_Agent table.
There's a column in that table that contains the TN of the set the agent is logged into. Also, you can use this table to determine how many are logged in b/c if you don't see their TN, they are not logged in.