Thinking a Bot (1)

Next Post

Yesterday, this project entered in my radar:

http://hubot.github.com/

GitHub, Inc., wrote the first version of Hubot to automate our company chat room. Hubot knew how to deploy the site, automate a lot of tasks, and be a source of fun in the company. Eventually he grew to become a formidable force in GitHub. But he led a private, messy life. So we rewrote him.

Today’s version of Hubot is open source, written in CoffeeScript onNode.js, and easily deployed on platforms like Heroku. More importantly, Hubot is a standardized way to share scripts between everyone’s robots.

Interesting, isn’t it? And it’s using Node.js. You know my position: JavaScript + Node.js + TDD is butter 😉

Some months ago, I started to play with autonomous agents, see my Spanish post

Inteligencia Artifical en C# (1) Primeros Agentes

and projects:

https://github.com/ajlopez/SharpAima
https://github.com/ajlopez/NodeAima

(Node.js version was easier, less types, no friction)

My idea is to implement autonomous agents a la Russell Norvig:

 

And now, a bot in Node.js with plugins could be a first path to explore, to have a concrete implementation. An “intelligent” bot is an agent. Let’s explore the idea and implementation.

First: the bot is not related to chat, SMS, email servers, git account, etc. No. A bot is an entity with:

– Input channels (“percepts” in the above picture), to receive message from the environment
– Output channels, to send message to the environment
– Plug-ins

Each plug-in could:

– Implement an input channel, i.e., a plug-in could connect to a chat session, read message from it, and send them to the bot. Or a plug-in that reads messages from a remote queue. Or a plug-in that reads data from a physical sensor.
– Implement an output channel, the same bot could send message from bot to the chat room. Or an output channel could manage LEDs in Raspberry or Arduino.
– Subscribe to messages, i.e. saying “all message that starts with ‘github ‘” are important to me.
– Send message to bot output channel(s)
– Do something, imagine a plug-in to run Grunt tasks, or run tests in a project

A picture:

Each plug-in could be implemented as a JavaScript module, to be install using NPM (Node Package Manager). And it could be tested in isolation. The bot behavior should be simple: a coordinator. And again, it could be build easily using TDD, asynchronous call in Node.js.

A message can be:

– A simple string
– A simple object (ready to be serialized as JSON, if needed)

Some methods would receive a message, and an additional object (named options?) with additional information, like original channel, etc… But I prefer to start simple. Remember:

Baby steps, make it works, make it right, make it fast

More ideas: there could be channels between bots, even distributed bots.

Some of these ideas are implemented in projects mentioned in my post

Distributed Applications and Node.js

It’s time to put these ideas to work.

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

3 thoughts on “Thinking a Bot (1)

  1. Pingback: Thinking A Bot (2) | Angel "Java" Lopez on Blog

  2. Pingback: Free download truecaller for windows xp

Leave a reply to Thinking A Bot (2) | Angel "Java" Lopez on Blog Cancel reply