Artificial Intelligence Markup Language (AIML)

Table of contents

Automate your business at $5/day with Engati

Switch to Engati: Smarter choice for WhatsApp Campaigns 🚀
Artificial Intelligence Markup Language

What is AIML?

Artificial Intelligence Markup Language (AIML) is a specialized markup language that is used to create chatbots & conversational agents, that adhere to a specific pattern-matching & response generation approach.

AIML makes it possible to create human interfaces while keeping the implementation simple to program, easy to understand and highly maintainable. 

Artificial intelligence markup language was first developed by Dr. Richard Wallace and a worldwide free software community between 1995 and 2002.

It formed the idea for A.L.I.C.E. (Artificial Linguistic Internet Computer Entity),  initially a vastly extended version of Eliza, that won several awards. It is offered by the ALICE AI Foundation and is an open source framework for building bots.

What are the basic concepts in AIML?

Pattern - A pattern is the specific user input or query that the chatbot aims to recognize. It is the trigger that prompts the chatbot to respond.

Templates - A template is a pre-defined response that the chatbot gives when a user input matches a specific pattern.

Category - A category is a combination of a pattern & its corresponding template.

Wildcards - A wildcard is a special character that is used within patterns to capture the variable parts of the user inputs.

Atomic patterns - They are specific keywords & phrases used as standalone patterns.

Response generation - AIML templates define the responses that the chatbot will generate.

Built-in predicates & functions - They allow chatbots to access information & perform certain actions.

AIML contains a collection of rules which define the conversational capabilities of the chatbot. it’s used with a linguistic communication Understanding (NLU) processor which takes AIML rules to investigate and reply to the text queries asked via the chatbot. The more rules we add in AIML – the more intelligent the chatbot is. AIML even characterizes rules for patterns and determines the manner in which to respond to the user accordingly. Artificial intelligence markup language has numerous elements in it, like categories, patterns, and templates.

The categories are the fundamental units of knowledge that the AIML makes use of and are further classified as templates and patterns. The templates represent the questions that the user asks the chatbot, or what the chatbot perceives to be questions that need to be responded to. The templates are the answers that the AIML chatbot remembers on the basis of it’s training  which are subsequently modified and presented as replies to the users. Template elements are essentially made up of text formatting for the responses, conditional responses taught to it including several if/else scenarios and random responses which always come in use while the bot is interacting with a user.

AIML based chatbots come under the rule-based chatbots category, however, some level of self-learning feature is feasible.​​​​​​​

  • AIML is that the language to make a brain for chatbots.
  • NLU in chatbots process AIML and their chat behavior is controlled through AIML rules.
  • One chatbot application can have multiple sets of AIML and might behave differently.​​​​​​​

AIML- based chatbots have the ability to work with a range of input, which basically represents the texts with identical meaning. One of the limitations of AIML chatbots is that if no input pattern is satisfied, the bot will just end up replying with a default statement like “Sorry, I could not understand your request”.

But if you have given rich AIML rules, it will be possible for you to build a chatbot that can handle a fairly broad range of queries. These bots are particularly useful for domain-specific businesses like banking where the bot could take care of generic queries associated with that domain.

The purpose of AIML is to  simplify the task of dialog modeling and make it easier according to the stimulus-response approach.

Artificial intelligence markup language is an XML-based markup language and it is a tag-based language.

The tags are identifiers that make code snippets and insert commands in the chatbot.

AIML defines a data object class called AIML objects which hold the responsibility for modeling patterns of conversation. AIML objects are technically language tags, and every tag corresponds to a language command.

What are the fundamentals of Artificial Intelligence Markup Language (AIML)?

After knowing what is AIML, this is how it describes a category of information objects called AIML objects and partially describes the behavior of computer programs that process them.

AIML objects are made of units called topics and categories, which contain either parsed or unparsed data. Parsed data is created of characters, several of which form character data, and a few of which form AIML elements.

AIML elements encapsulate the stimulus-response knowledge contained within the document. Character data within these elements is usually parsed by an AIML interpreter and sometimes left unparsed for later processing by a Responder.

artificial intelligence markup language
Source: Analytics Vidhya

What are some of the most important Artificial Intelligence Markup Language tags?

Artificial Intelligence Markup Language tags
Artificial Intelligence Markup Language tags

<aiml> tag

<aiml> tag marks the start and end of a AIML document. It contains version and encoding information under version and encoding attributes. This attribute is optional.

Encoding attributes provide the character sets to be used in the document. As a mandatory requirement, <aiml> tag must contain at least one <category> tag. We can create multiple AIML files where each AIML file contains a single <aiml> tag. The purpose of each AIML file is to add at least a single knowledge unit called category to the chatbot.

<category> tag

<category> tag is the fundamental knowledge unit of a Bot. Each category contains −

  • User input in the form of a sentence which can be an assertion, question, and exclamation etc. User input can contain wild card characters like * and _.
  • Response to user input to be presented by the chatbot.
  • Optional context.

A <category> tag must have <pattern> and <template> tag. <pattern> represents the user input and template represents the bot's response.

<pattern> tag

The <pattern> tag represents a user's input. It should be the first tag within the <category> tag. <pattern> tag can contain wild card to match more than one sentence as user input.

AIML is case-insensitive. If a user enters “Hello,” “hello,” “HELLO” etc., all inputs are valid and bot will match them against your greeting message.

<template> tag

<template> tag represents the bot's response to the user. It should be the second tag within the <category> tag. This <template> tag can save data, call another program, give conditional answers or delegate to other categories.

Close Icon
Request a Demo!
Get started on Engati with the help of a personalised demo.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
*only for sharing demo link on WhatsApp
Thanks for the information.
We will be shortly getting in touch with you.
Oops! something went wrong!
For any query reach out to us on
Close Icon
Congratulations! Your demo is recorded.

Select an option on how Engati can help you.

I am looking for a conversational AI engagement solution for the web and other channels.

I would like for a conversational AI engagement solution for WhatsApp as the primary channel

I am an e-commerce store with Shopify. I am looking for a conversational AI engagement solution for my business

I am looking to partner with Engati to build conversational AI solutions for other businesses

Close Icon
You're a step away from building your Al chatbot

How many customers do you expect to engage in a month?

Less Than 2000


More than 5000

Close Icon
Thanks for the information.

We will be shortly getting in touch with you.

Close Icon

Contact Us

Please fill in your details and we will contact you shortly.

This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
Thanks for the information.
We will be shortly getting in touch with you.
Oops! Looks like there is a problem.
Never mind, drop us a mail at