What is AIML?
Learn what AIML is and how it works
AIML (AI Markup Language)
AIML is a declarative language for building AI/LLM Agents using MDX and an extended version of the SCXML (State Chart XML) standard. AIML makes it easy to create AI agents, simple to sophisticated, supporting complex conversation flows and code execution, tool integration, and full state management.
How does AIML work?
An AIML document is sent to an AIML proxy server, which is a normal HTTP server that can be deployed anywhere. The AIML proxy server processes the AIML document to create a state chart and execute the request.
What does AIML look like?
AIML is Markdown + MDX. No SDKs to install, no classes to import, no complex syntax to learn.
Document Order Execution
AIML prompts are executed sequentially from top to bottom, making it intuitive to build complex prompt pipelines. Each text section, and element (along with it's children) is processed in order, allowing you to create sophisticated workflows while maintaining readability.
Circular Logic
To create circular logic, AIML supports <state>
elements. States, along with <transition>
elements allow you to create loops, or to create more complex conditional logic by tying one or more states together.
This will create a conditional loop that can be visualized as a flow chart like this:
Start simple and iterate
You can progressively enhance AIML prompts by adding additional steps.
For example, here's a simple AIML prompt:
This creates an agent that responds with a simple message, but we want to have it respond with actual weather data. We can do this by adding tool call and response steps:
The above is interpreted by the AIML proxy as a 3 step agent flow:
This is a very basic example, with AIML you can create much more complex agents that include multi-turn, tool calling, code execution, loops, and more.
See the following for more complex examples: