It is highly recommended not to use UI classes in the agents as sometimes it has problems accessing the same.
Set thisdb = session.CurrentDatabase
Set collection = thisdb.UnprocessedDocuments
This collection would have all the selected document/s which can be processed by the user.
Do let me know in case of any issues.