If you'd like to operate on a CGI variable in your agent, you must include a text field that is named the same as the CGI variable on your form. You can then use "Session.DocumentContext" in your $$QueryOpenAgent or $$QuerySaveAgent to access the CGI variable like so:
Dim session As New NotesSession Dim context As NotesDocument Set context = session.DocumentContext Print "HTTP_User_Agent = " & context.HTTP_User_Agent(0)
This will display the web browser being used.