Aexol Language Tutorial

Learn Aexol by building a complete e-commerce specification from scratch. By the end, you'll understand types, visitors, workflows, and agents.


Step 1: Define Your Data Types

Start with the data structures your system needs. Aexol types are like TypeScript interfaces — they define fields with types.

type Product {
  id: string
  name: string
  price: number
  inStock: boolean
}

type Order {
  id: string
  customerId: string
  items: OrderItem[]
  total: number
}

type OrderItem {
  productId: string
  quantity: number
}
✨ Edit in Studio

What you just learned:


Step 2: Add Enums

Enums define fixed sets of values. Add order status and payment status:

enum OrderStatus {
  pending
  confirmed
  shipped
  delivered
  cancelled
}

enum PaymentMethod {
  credit_card
  paypal
  bank_transfer
}
✨ Edit in Studio

Update your Order type to use the enum:

type Order {
  id: string
  customerId: string
  status: OrderStatus
  paymentMethod: PaymentMethod
  items: OrderItem[]
  total: number
}
✨ Edit in Studio

What you just learned:


Step 3: Define a Workflow

Workflows define state machines — how entities move from state to state:

workflow OrderFlow {
  initial: pending
  pending -> confirmed when payment_received
  pending -> cancelled
  confirmed -> shipped when packed
  shipped -> delivered when customer_receives
  shipped -> cancelled when return_requested
}
✨ Edit in Studio

What you just learned:


Step 4: Define Visitors (Who Can Do What)

Visitors define capability hierarchies — what different roles can do:

visitor Customer {
  "browse products"
  "place order" {
    "view own orders"
    "cancel own order"
  }
  "manage account" {
    "view profile"
    "update profile"
    "view payment methods"
  }
}

visitor Admin {
  "manage products" {
    "add product"
    "edit product"
    "remove product"
  }
  "manage orders" {
    "view all orders"
    "update order status"
    "issue refund"
  }
  "view reports"
}
✨ Edit in Studio

What you just learned:


Step 5: Add Agents (Automated Actors)

Agents define autonomous entities that perform tasks:

agent InventoryBot {
  "check stock levels"
  "alert low stock"
  "auto-reorder"
}

agent NotificationService {
  "send order confirmation"
  "send shipping update"
  "send delivery notification"
}

agent PaymentProcessor {
  "validate payment"
  "process charge"
  "issue refund"
  "send receipt"
}
✨ Edit in Studio

What you just learned:


Step 6: Put It All Together

Here's the complete e-commerce spec:

type Product {
  id: string
  name: string
  price: number
  inStock: boolean
  category: string
}

type Order {
  id: string
  customerId: string
  status: OrderStatus
  paymentMethod: PaymentMethod
  items: OrderItem[]
  total: number
  createdAt: string
}

type OrderItem {
  productId: string
  quantity: number
  price: number
}

enum OrderStatus {
  pending
  confirmed
  shipped
  delivered
  cancelled
}

enum PaymentMethod {
  credit_card
  paypal
  bank_transfer
}

workflow OrderFlow {
  initial: pending
  pending -> confirmed when payment_received
  pending -> cancelled
  confirmed -> shipped when packed
  shipped -> delivered when customer_receives
  shipped -> cancelled when return_requested
}

visitor Customer {
  "browse products"
  "place order" {
    "view own orders"
    "cancel own order"
  }
  "manage account" {
    "view profile"
    "update profile"
    "view payment methods"
  }
}

visitor Admin {
  "manage products" {
    "add product"
    "edit product"
    "remove product"
  }
  "manage orders" {
    "view all orders"
    "update order status"
    "issue refund"
  }
  "view reports"
}

agent InventoryBot {
  "check stock levels"
  "alert low stock"
  "auto-reorder"
}

agent NotificationService {
  "send order confirmation"
  "send shipping update"
  "send delivery notification"
}

agent PaymentProcessor {
  "validate payment"
  "process charge"
  "issue refund"
  "send receipt"
}
✨ Edit in Studio

What's Next

You can now...Using...
Generate code from this specStudio → Code Generation or Remote MCP
Add advanced types (circular refs, multi-dim arrays)Advanced Type Features
Explore more workflow patternsWorkflow Recipes
See the complete syntaxLanguage Reference
Integrate with your editorWorking with AI & IDEs

Key Takeaways

  1. Types = data structures with typed fields
  2. Enums = fixed sets of named values
  3. Workflows = state machines with initial, when, and transitions
  4. Visitors = hierarchical capability trees for roles
  5. Agents = automated actors that handle background tasks

Build your spec, validate with Studio or the CLI, then generate production-ready code.