Building a Chat Bot in under 60 seconds with Karmaloop AIML Bot Server

The Rise of the Bots

We have entered the century of Artificial Intelligence, it is finally here. However we won’t have super smart Human like AI from day one. We will ease into the   process with dumb bots taking over mundane jobs and automating them. As an example, I am already done with manually setting up alarms. That job has gone to Siri and Alexa. I am also done setting reminders. They have taken that too. In this article, let us see how we can build a bot in under 60 seconds.

Karmaloop AIML Bot Framework

Brief History

Chat bots have been here since the 1990s. In the late 90s, Dr. Richard Wallace created an XML based specification called AIML or Artificial Intelligence Markup Language. This was clean, simple and easy to customize. I was going through my Computer Science graduation in 2005, and that is when I stumbled upon Dr. Richard Wallace’s work with ALICE. ALICE was a super smart chat bot for her time and her AIML files were craftfully done. At that time, I was learning C# and decided to build an AIML parser in C# to bring ALICE to life on my computer, and also use her as my final semester project. Long story short, it all went well, and I got through my engineering and got busy with a job and later, business. It was only until 2016 when the bug bit me again and I restarted work on the libraries and in 2018 I finally released the first Open Source version of what I called, Karmaloop AIML Bot Server. Today, I will show you how you can get started with a solid underlying foundation of ALICE bot and add your custom capabilities on top.

Download and Run Karmaloop AIML Bot Server

Get the binaries from the Releases page on Github – https://github.com/KarmaloopAI/karmaloop-aiml-bot-server/releases

If you are on Windows, extract and navigate to the folder then run the KarmaloopAIMLBotServer.exe file to run the bot server. If you are on macOS or Linux, install and use Mono to run the above file.


mono KarmaloopAIMLBotServer.exe

Awesome! Now you should have ALICE bot running on your machine. Open a web browser window and point it to http://localhost:8880/api/ChatUi/index.html

On Windows, you may need to run the following command to make sure the server can open port 8880 for listening to incoming API requests.


netsh http add urlacl url=http://*:8880/ user=Everyone listen=yes

Now chat and have fun!

Customize and add your own conversations

To explore this topic in full, you may first want to aprise yourself of AIML 2.0 specifications – https://callmom.pandorabots.com/static/reference/

Step 1.

In the folder where you extracted the binaries, should be a folder called “aiml”. This is where the AIML files are stored by default. Let us create a new aiml file called magicmirror.aiml and then copy paste the following code into the file


<!--?xml version="1.0" encoding="UTF-8"?-->
<aiml version="1.0">
<category>
  <pattern>MAGIC MIRROR IN MY HAND WHO IS THE FAIREST IN THE LAND</pattern>
  <template>My Queen, you are the fairest in the land.</template>
</category>
</aiml>

Save the file, and restart your bot server. Then at the chat prompt, type the question – Magic mirror in my hand, who is the fairest in the land?

The conversation should look somewhat like below:

As expected! The response is exactly what we coded into the aiml file. That is it. If this took you under 60 seconds to do, then you built your first chat bot in less than a minute.

OK, but how can I produce dynamic responses?

Hmm… so you are ready to build something more complex, and would like to mash external data into your responses… right? Like build a weather skill that can tell you the weather of any city in the world. So let us keep this complex bit for a later post, but if your curiosity is insatiable, then simply open the file called “zweather.aiml”. Then open the source code (which you can download from Github) and look up weather skill. Set breakpoints and see how the skill executes itself. If you are good, you should already be able to see the simplicity and power of this approach, but hey more on that later!

Where to go from here

Now that you know how to create a basic conversational bot with Karmaloop AIML Bot Server you may be itching to build your own conversational bot and handle complex conversations. May be you want to automate arguments with your wife (LOL). Whatever your need may be, you may want to invariably start with reading up on AIML 2.0 specs for which link has been shared above. You may also want to visit the Github page and see how to compile from source on your platform. If you need any help, do post in the comments section and I can surely help.

Happy Bot Building!

Leave a Reply

Your email address will not be published. Required fields are marked *