AutolangDocs
Active Development

Introduction to Autolang

Autolang is a capability-based execution runtime, deterministic scripting language, and custom virtual machine designed specifically for safely running generated code within backend systems. You embed it as a lightweight library - npm install autolang-compiler - rather than adopting a new backend language.

Why Autolang Exists

Executing dynamic logic (like Python or JavaScript) for AI agents creates a critical mid-flight failure problem. If an LLM hallucinates a function name, a dynamic runtime will execute the script perfectly until it hits the broken line. By then, the script may have already charged a credit card or sent an email. Because LLMs lack persistent runtime memory, recovering from this dirty state requires starting the expensive workflow all over again.

Autolang solves this by providing a language-level execution boundary with a Static Compiler. Instead of failing halfway through, Autolang checks all types and capability signatures before any execution begins. The compiler absorbs common syntax drift, and if a capability is hallucinated, it halts instantly at compile-time with zero side effects, allowing the AI to cheaply self-correct.

Key Capabilities

Capability Allowlist

Host applications explicitly register allowed functions and types. Generated scripts cannot access the filesystem, initiate raw network requests, or invoke dynamic code evaluation.

Static Pre-validation

Types and function signatures are validated at compile time before execution starts. If an invalid call is made, structured compiler diagnostics are returned immediately.

Resource Bounded Execution

Deterministic opcode execution limits and managed heap quotas prevent infinite loops and runaway memory consumption.

AI-Tolerant Language Design

Kotlin-inspired syntax with intentional syntax tolerance to absorb common LLM formatting drifts, backed by compile-time null safety to eliminate hallucinations.

Defense-in-Depth Architecture

Autolang does not replace operating-system sandboxes such as Docker, KVM, or microVMs. Instead, it replaces the general-purpose runtime (such as Python or Node.js) that executes inside those isolation boundaries. Combining Autolang with containerization provides true defense-in-depth: infrastructure isolation at the host layer, and strict capability enforcement at the language level.

Integration Example

The host application declares native capabilities, and the model generates a structured script to orchestrate the workflow in a single local execution:

import { ACompiler } from 'autolang-compiler'; const compiler = await ACompiler.create(); // 1. Host registers explicit capabilities compiler.registerBuiltInLibrary("crm", ` class Customer(val id: Int, val name: String) @native("getCustomers") fun getCustomers(segment: String): Array<Customer> `, { autoImport: true }, { getCustomers: (segment) => crmService.getSegmentCustomers(segment) }); // 2. Generated script executes securely inside the VM await compiler.compileAndRun("workflow.atl", ` @import("crm") val enterpriseList = crm.getCustomers("enterprise") println(enterpriseList) `); console.log(compiler.getOutput());