Going back to your original post...
One approach I've been thinking of is to create a totally stripped-down custom engine to run server-side, handling the AI and database functions. Do people do this? Does it sound like "you have no idea how much work that would be"?
This is what services like Pandorabots are already doing - to be honest I can't think of why you would want to do it client-side anyway - server-side makes the most sense. Probably the most successful chat or forum based bots around at the moment are based around ALICE and AIML technology. There are plenty of flavours available in terms of programming languages. This also includes PHP and SQL...
The main AIML PHP/SQL interpreters are Programme E and now Program O. Programme E development has unfortunately all but disappeared. I have tried it out in the past, it has bugs, things don't work right and so on...but if you know PHP then you should be able to customise it quite easily. There are a few people still swapping ideas around at SourceForge.
Now Program O is a new-comer, I haven't had a play with it, but again it is based on SQL/PHP. What would be most interesting about this version is that it is under active development. It looks promising.
So you can see that there are existing options if you just want a 'simple' chat-bot type AI. And with your knowledge of PHP you could customise them however you like.
How best to balance a high-traffic, but simple chat front-end with all the 'background' AI processing that must occur?
In my experience with PHP and SQL, they are pretty good at dealing with a lot of traffic. If you look around the internet you will find a mulitude of forums with hundreds or even thousands of members and most of these are based on PHP/SQL. They handle a lot of interaction very well indeed. A lot of it depends on the server of course and it's ability to handle large volumes of data (bandwidth in other words).
I doubt you would run into problems unless you really do have an obscene number of interactions. Pandorabots is the only chat bot service that I know of that has this problem, but they must be dealing with many thousands of interactions an hour. The answer to that is to spread the load over more severs, but since it's a free service mainly there are limitations money-wise.
Anyway, here's some links :
Programme E :
http://sourceforge.net/projects/programe/Programme O :
http://www.program-o.com/I hope that helps a little.