AutolangDocs
FAQ

Autolang FAQ

Honest, technical answers about Autolang design tradeoffs, comparisons with existing runtimes, security boundaries, and enterprise integration patterns.

Core Philosophy

Why should I trust AI-generated code at all?

You shouldn't. Autolang is designed on the fundamental principle that AI code is inherently untrusted.

Instead of relying on LLM self-restraint or prompt engineering, Autolang enforces a strict default-deny model at the language level. An AI script cannot call any function, access any path, or perform any network request unless the host application explicitly grants that capability.

Why create a new language instead of restricting JavaScript?

Restricting a general-purpose language like JavaScript after the fact is harder than designing a language with dangerous features omitted from the start.

JavaScript includes features such as eval, dynamic imports, Function, global scope, prototype mutation, and dynamic typing. Removing or securing all of these across changing host environments is a constant auditing burden. Autolang is a statically typed scripting language with a lightweight virtual machine designed for AI-generated code: if a feature isn't in the language grammar, AI cannot invoke it.

Why not LLM Tool Calling?

Tool Calling works well for single operations. However, when an AI agent needs to execute multi-step workflows (e.g. fetch record, filter data, loop through items, update database), multi-step workflows often require repeated model interactions and additional latency.

Autolang allows the LLM to generate a single script containing all control flow and calculations. The script executes locally inside the VM in a single pass with predictable behavior and without model network latency.

Why not just let the LLM call my existing APIs directly?

Direct tool calling is ideal for simple operations. Autolang becomes useful when the model needs to write loops, conditions, temporary variables, data transformations, or multi-step workflows while remaining inside a restricted execution environment.

How does Autolang handle API hallucinations from lightweight models?

Lightweight AI models are fast and affordable, but they frequently hallucinate non-existent methods, invent properties, or attempt type-casting bypasses.

Autolang addresses this through compile-time static analysis. If an AI script invokes an unregistered function or passes incorrect argument types, the compiler rejects the script before execution starts and generates a precise stack trace. This error context can be passed back to the model for automatic correction.

Current Limitations

What are Autolang's current limitations?

Autolang is an early-stage runtime built specifically for AI script execution. You should be aware of the following current limitations:

  • Ecosystem size: Small standard library compared to Python or Node.js. It is designed to orchestrate host APIs, not replace third-party package managers.
  • No independent security audit yet: While designed defensively (no direct OS API access, no eval, default-deny), it has not undergone formal third-party security audits.
  • Single-threaded per VM: A single VM instance executes synchronously on one thread. Parallelism requires spawning multiple VM instances across host worker threads.
  • Not for general backends: It lacks general-purpose language features like async/await, multi-threading primitives, or built-in networking capabilities.

Can Autolang protect against insecure host native code?

No. Autolang controls what functions the AI script is authorized to call, but it cannot prevent security bugs inside host-written @native bindings.

If a host native function performs raw SQL concatenation or improper input sanitization, that vulnerability remains inside host code. Autolang governs execution boundaries, not host implementation security.

Comparisons

Why not run JavaScript inside isolated-vm?

isolated-vm is a mature, production-grade library for isolating JavaScript execution via V8 isolates. It includes native memory limits and execution timeout controls.

Autolang solves a different problem: it reduces the execution surface by removing the JavaScript runtime entirely.

isolated-vm (JavaScript)

isolated-vm executes JavaScript inside a V8 isolate. The host must manage bindings and memory limits within V8 sandbox boundaries.

Autolang DSL

Autolang instead removes the JavaScript runtime and exposes only a purpose-built language for AI-generated scripts.

Autolang also features a static type checker. If an AI script calls an invalid method or passes incorrect argument types, compilation fails before execution starts.

FeatureAutolangisolated-vm
Purpose-built for AI-generated codeYesNo
Static type checking & diagnosticsYesNo
Minimal non-JS grammar surfaceYesNo
Language-level capability modelYesNo
Configurable memory & timeout limitsYesYes
Execute existing JavaScript librariesNoYes
Mature ecosystem & V8 backingNoYes

Why not Lua?

Lua is a highly mature, ultra-fast embedded scripting language widely used in games and Nginx. However, Lua is dynamically typed and lacks compile-time type checking.

Autolang provides static typing, null safety (String? vs String), and compile-time diagnostics designed to catch LLM hallucination errors before execution.

Why not QuickJS or Duktape?

QuickJS and Duktape are lightweight JavaScript engines. They are excellent choices when your goal is to embed and execute JavaScript inside an application.

Autolang solves a different problem. Instead of embedding a general-purpose language and then restricting what it can do, Autolang provides a purpose-built language designed specifically for AI-generated code. The language itself excludes features such as dynamic evaluation, unrestricted runtime capabilities, and implicit global state, reducing the amount of functionality that must be secured.

Autolang also performs static type checking and compile-time validation before execution. Invalid API calls, type mismatches, or unauthorized capability usage are rejected during compilation instead of failing later at runtime.

If your application needs JavaScript compatibility or wants to execute existing JavaScript code, QuickJS or Duktape are likely the better choice. If your goal is to safely execute AI-generated scripts with explicit host capabilities and predictable behavior, Autolang is designed for that use case.

FeatureAutolangQuickJS / Duktape
Execute existing JavaScriptNoYes
AI-oriented language designYesNo
Static type checkingYesNo
Compile-time diagnosticsYesNo
Capability-based host APIYesNo
JavaScript ecosystem compatibilityNoYes

Why not Python?

Python is the dominant language for AI, data science, and automation. It has a mature ecosystem and is an excellent choice for building AI systems.

However, Python was designed as a general-purpose programming language, not as a constrained runtime for executing untrusted AI-generated code.

By default, Python exposes a large execution surface. The standard library provides filesystem access, networking, dynamic imports, subprocess creation, reflection, serialization, and many other capabilities. Restricting these features requires additional sandboxing, policy enforcement, or operating-system isolation. Even then, new libraries or overlooked APIs can introduce unexpected attack surfaces.

Autolang takes a different approach. Instead of starting with a fully capable language and restricting it afterward, it starts with no capabilities at all. Scripts can only access APIs that the host application explicitly exposes. Anything not explicitly registered is unavailable.

Autolang also performs static type checking and compile-time validation before execution. Invalid API calls, type mismatches, or unauthorized capability usage fail compilation instead of producing runtime errors.

In addition, the runtime is optimized for short-lived AI workflows, with fast startup (~10 ms), low memory usage, predictable execution, and VM reset after each run. These characteristics make it practical to create and destroy large numbers of isolated AI execution sessions.

Autolang does not compete with Python as an AI development language. It complements Python by providing a safer execution environment for AI-generated code.

LLM → Generates Autolang → Autolang VM → Calls Host API → Python Backend (PyTorch / Pandas / NumPy)

If your goal is to build AI models, train neural networks, or use the Python ecosystem, Python is the obvious choice. If your goal is to execute AI-generated scripts safely inside an application with explicit capability control, Autolang is designed specifically for that scenario.

Does Autolang replace Docker?

No. Docker provides OS-level container isolation. Autolang provides language-level capability control. The two complement each other and are often deployed together in enterprise systems.

Security Architecture

How is the sandbox enforced?

Security is enforced by design rather than runtime policies:

  • Restricted Host Access: Scripts cannot invoke operating-system APIs unless exposed by the host application.
  • No Built-in Networking: Scripts have no built-in networking capabilities.
  • No Dynamic Evaluation: There is no eval() or Function() constructor to execute dynamic code strings at runtime.
  • Strict Capability Binding: Scripts can only execute functions explicitly bound by registerBuiltInLibrary().

Read the complete breakdown in the Security Model Document.

Can AI access files or the network?

Filesystem and network operations are disabled by default. If enabled, access is strictly scoped via host configuration:

  • compiler.setAllowedFilePathsRules(['/app/data/*']) — restricts file paths.
  • compiler.setAllowedDomainsRules(['api.company.com']) — restricts HTTP domains.

Integration & Adoption

Can I gradually adopt Autolang without rewriting my backend?

Yes. Autolang is designed for incremental adoption. You do not need to rewrite your backend services or database layers.

You register a single native library wrapping your existing Node.js or C++ service methods and pass AI scripts to the compiler instance.

How does an integration look in code?

Here is a complete end-to-end integration example using the autolang-compiler package in TypeScript:

import { ACompiler, AutolangNativeFunc } from 'autolang-compiler'; // 1. Initialize VM compiler const compiler = await ACompiler.create(); // 2. Define native capability delegates const sendMail: AutolangNativeFunc = (to, body) => { console.log(`Sending mail to ${to}: ${body}`); return true; }; // 3. Register capability library for AI scripts compiler.registerBuiltInLibrary( "app/mail", ` @native("sendMail") fun send(to: String, body: String): Bool `, { autoImport: true }, { sendMail } ); // 4. Compile and execute AI script safely await compiler.compileAndRun("agent.atl", ` val success = send("user@example.com", "Your report is ready.") println("Mail sent: " + success) `); console.log(compiler.getOutput());

Why use @js_object for host objects?

@js_object is intended to expose behavior rather than copy object state. Prefer explicit methods such as getName() and setName() instead of duplicating large host objects inside the VM.

Instead of copying host data structures into script memory, Autolang holds a lightweight handle to the host object and forwards method calls directly.

See Best Practices Guide.

Runtime & Operations

What is the runtime performance and memory overhead?

Native C++ compiler execution cold start is ~10ms with warm restart of ~1–2ms and ~0.5 MB to 2 MB RAM footprint.

In WebAssembly/Node.js environments, warm script execution starts in ~1–2ms with ~10MB shared module RAM.

Is Autolang thread-safe?

Each compiler/VM instance is intended to be used from a single thread. For multi-threaded concurrency, spawn independent instances across worker threads.

What license is Autolang released under?

Autolang is an open-source project hosted on GitHub under the MIT License.