Is the agent private or shared ?
Normally i use session.documentcontext in Web, your session.doc is emty because the property documentcontext works only with a selected or in-memory doc.
Try this: Database.UnprocessedDocuments
It takes all unprocessed doc in a collection.
cu