System Architecture
This document explains how Autolang executes AI-generated code. It does not focus on language syntax or APIs, but on runtime responsibilities, execution boundaries, and system ownership.
System Overview
The LLM is responsible only for producing source code. From that point onward, execution becomes entirely deterministic and is controlled by the compiler, VM, and host application.
User
│
▼
Prompt
│
▼
LLM Model
│
▼
Autolang Compiler
│
▼
Autolang VM
│
Native Bindings
│
▼
Host Application
│
Business SystemsRuntime Ownership Matrix
Clear boundaries separate non-deterministic code generation from deterministic execution, capability dispatch, and authority ownership:
| Component | System Ownership |
|---|---|
| LLM | Source code generation |
| Compiler | Static validation & bytecode compilation |
| VM | Execution, stack interpreter & resource budgeting |
| Bindings | Capability dispatch & parameter marshaling |
| Host Application | Authority, credentials & budget configuration |
| Business Systems | Persistent enterprise data & side effects |
Execution Pipeline
Every execution flows sequentially through distinct system boundaries:
LLM Code Generation
Generates orchestration text. The LLM's task finishes completely once the source code is produced.
Compiler Validation
Performs lexing, parsing, import symbol resolution, static type checking, and bytecode emission. Rejects invalid code before execution starts.
VM Execution
Executes instructions via stack interpreter. Enforces opcode budgets, tracks VM heap allocations, and traps runtime exceptions.
Host Capability Dispatch
Native bindings unwrap parameters and delegate invocation to host application functions under host authority.
Compiler vs. VM Responsibilities
The compiler and VM maintain strict division of labor between static analysis and dynamic execution:
| Compiler (Static Analysis) | VM (Dynamic Execution) |
|---|---|
| Parse source text into AST | Execute bytecode instructions |
| Static type check & null safety | Evaluate stack opcodes |
| Build binary bytecode chunk | Track instruction opcode budget |
| Validate @import library declarations | Invoke native capability bindings |
| Reject invalid code pre-run | Produce execution output buffer |
Host Application Responsibilities
Autolang is not a standalone server — the host application (Node.js or C++) acts as the embedding server and central authority. Host responsibilities include:
Capability Registration
Registers explicit capabilities via registerBuiltInLibrary().
Authority & Credentials
Holds all database sockets, API keys, and environment secrets safely outside the VM.
Business Logic Execution
Executes core enterprise logic (CRM, ERP, Mail) when native bindings are invoked.
Resource Governance Config
Configures opcode limit caps (e.g. 100,000 opcodes) and file/HTTP security rules.
Capability Boundary
Authority lives in code you write and control. Autolang scripts never hold authority directly — credentials stay inside the host, bindings own capability access, and scripts only invoke capabilities granted to them.
Host Application (Owns credentials, DB sockets, API keys)
│
▼
Bindings (Expose capability methods)
│
▼
Capabilities (Declared interfaces)
│
▼
Autolang VM Sandbox (Stack interpreter, resource limits)
│
▼
AI Script (Untrusted orchestration logic)Host Session Lifecycle
The lifecycle of a compiler and VM session inside an embedding application follows a clean, deterministic pattern:
Create Compiler Instance (ACompiler.create())
│
▼
Register Native Libraries & Capabilities
│
▼
Compile Script (Static validation & bytecode build)
│
▼
Execute VM (Stack evaluation under opcode budget)
│
▼
Reset VM State (Clear output & stack pointers)
│
▼
Compile Next Script ──or──▶ Dispose CompilerRelated Documentation
This Architecture overview provides the system map. For specialized implementation topics, explore the dedicated documentation guides:
Runtime & VM Internals
Deep dive into C++ VM internals, AObject struct memory layouts, stack frames, and allocation arenas.
Philosophy & Vision
Core design philosophy, default-deny security model, and performance context vs container isolation.
Native Libraries
How to define @native interfaces and register JavaScript capability bindings with the compiler.
Security & Sandboxing
Configuring HTTP domain rules, file path allowlists, and instruction limit caps in host code.
