Creating Your Own Virtual Agent Chatbot using AIML

AIMLWe wrote in an earlier post about two virtual agent software vendors that offer tools you can use to quickly get a virtual agent up and running for your business’s website. If you have loftier ambitions and more time, you can construct a virtual agent from the ground up. There are several chatbot scripting language frameworks available that you can use to develop anything from a simple conversational chatbot to a more complex virtual customer support assistant. In this post, we’ll take a quick look at AIML.

AIML, which stands for Artificial Intelligence Markup Language, is the creation of Dr. Richard Wallace and is offered as an open source chatbot scripting framework by ALICE AI Foundation. AIML is similar to HTML or XML, in that it consists standard and extensible tags that you use to mark up text so that it can be understood by an the AIML interpreter.

Pandorabots offers an extensive tutorial on how to build your chatbot using AIML. The concept behind AIML and other similar frameworks if straightforward. As the botmaster, you need to try to predict all the possible inputs that your chatbot will have to respond to. For every input, you write a matching output. The art of writing good AIML lies in this predictive reasoning, but also in using the tools of AIML to try to account for all the different ways in which a human can say basically the same thing. For example, if your chatbot only recognizes the greeting “Hello,” it won’t have a good response if someone says “Hi,” “Howdy,” Hey,” or “Good Morning.” This multiplicity of common inputs is one of the challenges that botmasters face and that scripting languages like AIML are equipped to deal with.

In my experience, an effective way to build your AIML virtual assistant and test it out is to sign up for a free user account on Pandorabots. Pandorabots has been around for many years and provides both a free AIML bot hosting platform, as well as a more robust platform for commercial use for a monthly fee. I found the free environment to be easy to use and a good way to debug my first chatbots to help me better understand why some patterns weren’t matching up as I had expected.

Building your personal virtual assistant requires time. You’ll need to create enough input and matching response patterns to give your chatbot the ability to have at least a rudimentary conversation. Pandorabots offers you the option of beginning your virtual agent with pre-populated AIML templates. You’ll need to examine this content to determine if you want to use it, especially if you’re creating a chatbot to represent your business. Some of the default responses may not align with the message or tone that you’d like for your virtual agent, so it may be better to start from scratch.

AIML offers quite a bit of flexibility. There are techniques that enable your chatbot to remember the last thread of a conversation and respond appropriately. This response can be conditional. For example, you can have the virtual chatbot ask “How are you feeling today?” and it can offer a different response, depending on how the other party answers the question.

Skipper-Bot is an example of a fairly simple AIML chatbot that I created. Skipper-Bot’s only function is to test people’s seamanship and boating knowledge. The chatbot randomly asks a series of True or False questions and lets the quiz taker know whether their response was correct or not. Give Skipper-Bot a try and test your boating knowledge. At the end of this article you’ll find a short sample of the AIML mark-up that controls Skipper-Bot’s conversational ability:

As you add more patterns and work on training your virtual AIML agent, there are numerous forums you can turn to for help from other AIML developers. One such forum is located on

Once your conversational chatbot is ready to deploy, you have the option of using a hosting platform that provides a speaking avatar to represent your virtual agent. SitePal is an example of an intelligent agent hosting provider that offers a choice of animated, talking avatars. Research by experts such as Amy L. Baylor has shown that people are much more likely to make a meaningful connection with a life-like avatar than with a disembodied voice. If your virtual agent communicates via a simple text interface, then you should at least consider personalizing the chatbot with a representational photo.

In future posts, we’ll introduce some alternative virtual agent chatbot development frameworks that you might also want to consider for constructing virtual support agents to assist your online customers.

Sample AIML Snippet from Skipper-Bot

<?xml version=”1.0″ encoding=”UTF-8″?>

<aiml version=”1.0″>





<li>True or False: Midchannel buoys are always even numbered</li>

<li>True or False: The right side of the boat is called the port side</li>

<li>True or False: Boats 16 feet or more must carry at least two throwable PFDs on board</li>






<that>Midchannel buoys are always even numbered</that>

<template>Nope. Trick question! Midchannel buoys aren’t numbered at all!</template>




<that>Midchannel buoys are always even numbered</that>

<template>Very good! They aren’t numbered at all</template>



Share your thoughts on this topic

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s