A Sketchbook for an Intelligent Web Agent

titivillus on 2006-07-02T19:03:18

I was looking through some stuff online and it struck me that an Intelligent Agent architecture would be fairly easy to implement, using only Open Source/Free Software tools.

The Agent would be running as a daemon, built using Perl and easily available Perl modules, for SOAP, CGI, AJAX and whatever else you need. Early in development, you'd have a collection of stump functions to call, and per Paul Graham, once you have a working Agent, you can add and extend functionality.

On the client side, you'd run Mozilla, and your agent communication code would run as a GreaseMonkey script set to run on every page, and probably sending the URL, REFERER and a few other points for each page.

You'd also have a Javascript-laden page on your sidebar, which uses AJAX to communicate with the Agent and present you with the data.

But what data?

I'm not actually sure yet. Depends on context. Depends on what you want. I can come up with a few usage scenarios, though.

1) You have 5 tabs open in Mozilla. They are the HTTP 1.1 RFC, documentation on CGI::AJAX, a Javascript tutorial, an article on Perl.com and a web page you're using all the other documentation to put together. The sidebar scripting could tell you're looking at the RFC and tell the Agent, which uses a Google module to get other links to HTTP-related pages. Or it can take the data it has and know that your top 5 places to go in general are Google, Slashdot, O'Reilly, Use Perl and MySpace.com, and show links to those. Or, it can notice that the RSS for Megatokyo.com has changed and tell you that the new comic is up. I think that adding to what you can do with this framework would be easy. That is, once the framework is implemented.

Questions: 1) How easy is it to handle tabs in Javascript? Finding out how many windows and how many tabs are open, and what tab has focus, or whatever the terminology is.

2) How easy is it to write network traffic in Javascript? It should be a mostly solved problem, with AJAX, but I'll still have to look it up.

I figure once we get four things done (javascript code for pulling info about windows and tabs, a solid system for sending browse data to the Agent, AJAX communication between the sidebar and the Agent, decent installers for each part), development can begin on the interesting part, which is deciding what the Agent actually does.

Comment if you're interested, or at least think I'm on the good kind of crack.