AIML Docs

Getting Started

Learn how to create your first AI agent using AIML

Getting Started with AIML

This guide will help you create your first AI agent using the AIML language.

Coming soon: AIML Language support for VS Code, Cursor, Vim, Emacs and more!

Basic Structure

At the end of the day, an AIML file is just a markdown (MDX to be precise) file with a more forgiving syntax parser and some intrinsic XML/JSX elements.

Here's a minimal example:

---
name: my-agent
model: account/fireworks/model/deepseek-v3
---
 
You are a helpful assistant that provides concise, accurate responses. Always begin your responses with "Agent:"
 
<if condition={({lastElement}) => !lastElement.output.startsWith("Agent:")}>
    <script language="javascript">
        return `Agent: ${lastElement.output}`;
    </script>
</if>

Here if the model doesn't start with "Agent:" we add it to the output using a script element.

AIML will handle conversion to/from streams making easy things easy and hard things possible!

Key Concepts

Frontmatter

The frontmatter section at the top of the file (between --- markers) defines default settings:

---
model: account/fireworks/model/deepseek-v3
---

System Prompt

The text immediately following the frontmatter serves as the system prompt for your agent:

You are a helpful assistant that provides concise, accurate responses.

Elements

Elements are XML/JSX-style tags that define your agent's behavior:

<llm>
    <instructions>
        Process the user's input carefully and provide a helpful response.
    </instructions>
    <prompt>
        {({userInput}) => userInput.message}
    </prompt>
</llm>

Comments

Use JSX-style comments to add notes that won't be sent to the LLM:

{/* This comment won't be included in the LLM context */}

Creating Your First Agent

Let's create a simple agent that thinks about a response before answering:

---
model: account/fireworks/model/deepseek-v3
---
 
{/* This is a system prompt and acts as the first step in the workflow */}
You are a helpful assistant that thinks carefully before responding.
 
 
{/* Then provide the actual response */}
<llm model="accounts/fireworks/models/qwen3-30b-a3b">
    <instructions>
        {({lastElement}) => `Based on the previous analysis (${lastElement.output}), 
        provide a clear and helpful response to the user.`}
    </instructions>
    <prompt>
        {({userInput}) => userInput.message}
    </prompt>
</llm>

Next Steps

On this page