The agent architecture is very similar for RAS, MAPI, and e-mail. The main source of difference is signaling and data transfer methods.
The host agent detects a new query by receiving a signal. The query signal could be the creation of a file using RAS, the receipt of an e-mail using PARAMBLK, or the receipt of an e-mail with certain keywords or attached files.
The remote agent detects that the results are available by receiving a signal, the results signal. The results signal could be the deletion of the query file using RAS, the receipt of an e-mail using PARAMBLK, or the receipt of an e-mail with certain keywords or attached files.