<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hoàn Lương</title>
    <description>The latest articles on DEV Community by Hoàn Lương (@hoanluong123).</description>
    <link>https://dev.to/hoanluong123</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3950758%2F3aa5381a-a0c9-4c32-8919-1a5da59883f7.png</url>
      <title>DEV Community: Hoàn Lương</title>
      <link>https://dev.to/hoanluong123</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hoanluong123"/>
    <language>en</language>
    <item>
      <title>Building Autolang: A Scripting Runtime for Lightweight AI-Generated Code</title>
      <dc:creator>Hoàn Lương</dc:creator>
      <pubDate>Sat, 08 Aug 2026 16:03:55 +0000</pubDate>
      <link>https://dev.to/hoanluong123/building-autolang-a-scripting-runtime-for-lightweight-ai-generated-code-h8j</link>
      <guid>https://dev.to/hoanluong123/building-autolang-a-scripting-runtime-for-lightweight-ai-generated-code-h8j</guid>
      <description>&lt;h1&gt;
  
  
  Building Autolang: A Scripting Runtime for Lightweight AI-Generated Code
&lt;/h1&gt;

&lt;p&gt;I have some projects but I don't have much money, so I often use Gemini Flash for UI tasks and some features.&lt;/p&gt;

&lt;p&gt;Gemini Flash is very fast and cheap, but sometimes it is surprisingly unreliable.&lt;/p&gt;

&lt;p&gt;It can hallucinate members or functions that don't exist, or use &lt;code&gt;as any&lt;/code&gt; just to make everything look OK.&lt;/p&gt;

&lt;p&gt;This made me think about a problem.&lt;/p&gt;

&lt;p&gt;Lightweight models are becoming extremely cheap, and I want to use them in my products. But if the models are going to generate code, maybe the solution isn't always to use a larger model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What if the runtime itself was designed around the weaknesses of lightweight models?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That is how I started building &lt;strong&gt;Autolang&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Project:&lt;/strong&gt; &lt;a href="https://autolang.vercel.app" rel="noopener noreferrer"&gt;https://autolang.vercel.app&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Documentation:&lt;/strong&gt; &lt;a href="https://autolang.vercel.app/docs" rel="noopener noreferrer"&gt;https://autolang.vercel.app/docs&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What is Autolang?
&lt;/h2&gt;

&lt;p&gt;Autolang is a scripting runtime library rather than a general-purpose programming language.&lt;/p&gt;

&lt;p&gt;I am building it as a small runtime sandbox for AI-generated code.&lt;/p&gt;

&lt;p&gt;The basic idea is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Developer-defined capabilities
            ↓
       AI-generated script
            ↓
       Autolang Compiler
            ↓
          VM / Runtime
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The developer decides what the AI can access.&lt;/p&gt;

&lt;p&gt;For example, instead of exposing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Database&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(...)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I would prefer exposing something more constrained:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Products.getProducts()
Users.getUsers()
Orders.getRecentOrders()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The AI can write the business logic, while the developer controls the capabilities available to it.&lt;/p&gt;

&lt;p&gt;This also means the generated script doesn't need access to an entire database API or operating system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why build another language?
&lt;/h2&gt;

&lt;p&gt;The main reason is not that I think another programming language is necessary for humans.&lt;/p&gt;

&lt;p&gt;I am interested in compilers, so Autolang is also a project for me to learn about compiler and runtime design.&lt;/p&gt;

&lt;p&gt;But I also want to explore whether a language can be designed around AI-generated code.&lt;/p&gt;

&lt;p&gt;For example, static typing can provide the model with much better feedback when it generates something incorrectly.&lt;/p&gt;

&lt;p&gt;Instead of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;something went wrong
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the runtime can provide a stack trace and a type error that gives the model enough information to fix its code.&lt;/p&gt;

&lt;p&gt;This is especially interesting for cheaper models, which may make mistakes more frequently.&lt;/p&gt;

&lt;h2&gt;
  
  
  Some of the features
&lt;/h2&gt;

&lt;p&gt;Autolang currently has or is designed around several features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Static typing&lt;/li&gt;
&lt;li&gt;Stack traces&lt;/li&gt;
&lt;li&gt;Runtime error information&lt;/li&gt;
&lt;li&gt;Opcode limits&lt;/li&gt;
&lt;li&gt;Managed VM memory&lt;/li&gt;
&lt;li&gt;Native function bindings&lt;/li&gt;
&lt;li&gt;Developer-controlled capabilities&lt;/li&gt;
&lt;li&gt;A small standard library&lt;/li&gt;
&lt;li&gt;No need for generated scripts to install new packages&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The syntax is statically typed and is inspired by languages such as Kotlin and TypeScript.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Products.getProducts()
    .filter { |product| product.remaining }
    .forEach { |product|
        ...
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I want generated code to be relatively compact because the AI shouldn't need to generate package installation code or large amounts of boilerplate.&lt;/p&gt;

&lt;p&gt;The language includes features such as &lt;code&gt;?.&lt;/code&gt;, &lt;code&gt;??&lt;/code&gt;, &lt;code&gt;!.&lt;/code&gt;, &lt;code&gt;as&lt;/code&gt;, &lt;code&gt;is&lt;/code&gt;, &lt;code&gt;fun&lt;/code&gt;, closures, and standard libraries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Developer-defined bindings
&lt;/h2&gt;

&lt;p&gt;One of the most important parts of Autolang is the binding system.&lt;/p&gt;

&lt;p&gt;A developer can define a library that the Autolang program can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;compiler&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;registerBuiltInLibrary&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;company/database&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;`
    class Product(
      remaining: Bool
      price: Int
    )

    @js_object
    class Products {
      @native("get_products")
      fun getProducts(): Array&amp;lt;Product&amp;gt;
    }
  `&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;autoImport&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;get_products&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// Native implementation&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Autolang VM keeps the type information.&lt;/p&gt;

&lt;p&gt;So when the native function returns products, the VM knows that the result is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Array&amp;lt;Product&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is different from simply exposing a generic JavaScript function and letting the generated code do whatever it wants.&lt;/p&gt;

&lt;p&gt;If more complex objects are needed, they can also be represented as native JavaScript objects:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@js_object
class Product {
    @native("get_price")
    fun getPrice(): Int

    @native("is_remaining")
    fun isRemaining(): Bool
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The developer decides which operations are exposed.&lt;/p&gt;

&lt;h2&gt;
  
  
  An example
&lt;/h2&gt;

&lt;p&gt;A TypeScript application can compile and execute an Autolang script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;compiler&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compileAndRun&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;main.atl&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;`
    var expenseCount = 0
    var normalCount = 0
    var cheapCount = 0

    Products.getProducts()
      .filter { |product| product.remaining }
      .forEach { |product|
        when (product.price) {
          &amp;gt;3 -&amp;gt; expenseCount += 1
          ==3 -&amp;gt; normalCount += 1
          else -&amp;gt; cheapCount += 1
        }
      }

    println(...)
  `&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;compiler&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getOutput&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important part is that the AI doesn't need to know how the database works.&lt;/p&gt;

&lt;p&gt;It only needs to know that &lt;code&gt;Products.getProducts()&lt;/code&gt; exists and what type it returns.&lt;/p&gt;

&lt;p&gt;The developer keeps control over the actual native implementation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why not tool calling?
&lt;/h2&gt;

&lt;p&gt;This is probably the first question people ask.&lt;/p&gt;

&lt;p&gt;I don't see Autolang as a replacement for tool calling.&lt;/p&gt;

&lt;p&gt;Tool calling is useful when the model needs to interact with external systems.&lt;/p&gt;

&lt;p&gt;I am interested in situations where the model needs to perform a lot of computation or data processing after obtaining the data.&lt;/p&gt;

&lt;p&gt;For example, imagine an internal SME application with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Users.getUsers()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and the AI needs to classify hundreds or thousands of users:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;VIP
NORMAL
INACTIVE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With a tool-calling approach, repeatedly sending requests between the model and the application can introduce additional latency and cost.&lt;/p&gt;

&lt;p&gt;Instead, the application could expose the data to an Autolang script and let the script perform the processing inside the runtime.&lt;/p&gt;

&lt;p&gt;So the model generates the logic once, rather than requiring a round trip for every individual operation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why not JavaScript, Python, or isolated-vm?
&lt;/h2&gt;

&lt;p&gt;JavaScript and Python are general-purpose programming environments.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;isolated-vm&lt;/code&gt; provides isolation for JavaScript.&lt;/p&gt;

&lt;p&gt;Autolang is trying to solve a somewhat different problem.&lt;/p&gt;

&lt;p&gt;I want the language itself to be small, statically typed, constrained, and predictable for generated code.&lt;/p&gt;

&lt;p&gt;The runtime knows about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Types&lt;/li&gt;
&lt;li&gt;Opcodes&lt;/li&gt;
&lt;li&gt;VM memory&lt;/li&gt;
&lt;li&gt;Native bindings&lt;/li&gt;
&lt;li&gt;Runtime errors&lt;/li&gt;
&lt;li&gt;Stack traces&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is not simply to execute untrusted JavaScript.&lt;/p&gt;

&lt;p&gt;The goal is to create an environment where an AI can generate a small script using a set of capabilities explicitly provided by the developer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is it a replacement for Docker or KVM?
&lt;/h2&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;I don't intend Autolang to replace Docker, KVM, microVMs, or operating-system-level isolation.&lt;/p&gt;

&lt;p&gt;Autolang is much more focused:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AI-generated code
        ↓
Developer-defined capabilities
        ↓
Autolang runtime
        ↓
Controlled execution
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is intended to be a sandbox for AI-generated scripts that operate through bound functions.&lt;/p&gt;

&lt;p&gt;For applications that require strong OS-level isolation, I would still expect technologies such as containers or VMs to be appropriate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Memory and runtime size
&lt;/h2&gt;

&lt;p&gt;One of my goals is to keep the runtime small.&lt;/p&gt;

&lt;p&gt;The current Autolang instance uses about &lt;strong&gt;0.5 MB with the full standard library enabled&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;1,800-line test peaked at around 3.8 MB on Windows 11&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;These are early measurements rather than formal benchmarks, but they are encouraging for the kind of lightweight runtime I am trying to build.&lt;/p&gt;

&lt;h2&gt;
  
  
  A possible use case
&lt;/h2&gt;

&lt;p&gt;The main use case I currently have in mind is internal SME software.&lt;/p&gt;

&lt;p&gt;For example, an application might expose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Users.getUsers()
Products.getProducts()
Orders.getRecentOrders()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then an AI could generate small programs to answer business-specific questions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Which customers are likely to be VIPs?

Which products are running low?

Which customers haven't ordered recently?

Which orders look unusual?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The developer doesn't need to implement every possible analysis as a separate feature.&lt;/p&gt;

&lt;p&gt;Instead, the developer provides safe capabilities and lets the AI generate the logic.&lt;/p&gt;

&lt;p&gt;That could potentially reduce development time for internal tools where requirements change frequently.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I am still unsure about
&lt;/h2&gt;

&lt;p&gt;Autolang is still an experiment.&lt;/p&gt;

&lt;p&gt;I don't know yet whether this is actually better than simply using JavaScript, Python, or existing sandboxing solutions.&lt;/p&gt;

&lt;p&gt;I also don't know how much the AI-friendly type system and error reporting will actually improve the reliability of lightweight models in practice.&lt;/p&gt;

&lt;p&gt;That is one of the reasons I am building it.&lt;/p&gt;

&lt;p&gt;I want to find out whether a small runtime designed around AI-generated code can provide a useful middle ground between:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Let the AI run arbitrary code"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Make every operation a separate tool call"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For now, Autolang is both a compiler/runtime project I enjoy working on and an experiment in making cheap AI-generated code easier to execute safely and predictably.&lt;/p&gt;

&lt;p&gt;If you are interested in the implementation, the project and documentation are here:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project:&lt;/strong&gt; &lt;a href="https://github.com/hoansdz/Autolang" rel="noopener noreferrer"&gt;https://github.com/hoansdz/Autolang&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Documentation:&lt;/strong&gt; &lt;a href="https://autolang.vercel.app/docs" rel="noopener noreferrer"&gt;https://autolang.vercel.app/docs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>programming</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>We built a scripting language just for AI agents. Here's why.</title>
      <dc:creator>Hoàn Lương</dc:creator>
      <pubDate>Mon, 25 May 2026 13:41:22 +0000</pubDate>
      <link>https://dev.to/hoanluong123/we-built-a-scripting-language-just-for-ai-agents-heres-why-1gm9</link>
      <guid>https://dev.to/hoanluong123/we-built-a-scripting-language-just-for-ai-agents-heres-why-1gm9</guid>
      <description>&lt;p&gt;One of our AI agents deleted a directory it was never supposed to touch. The Python it wrote was valid. The model was confident. It did the wrong thing.&lt;/p&gt;

&lt;p&gt;The agent was only supposed to query a database. But we gave it a full Python runtime, so it had access to &lt;code&gt;os&lt;/code&gt;, &lt;code&gt;shutil&lt;/code&gt;, everything. That's when we realized the problem wasn't the model — it was us handing it way too much power.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why sandboxing is harder than it looks
&lt;/h2&gt;

&lt;p&gt;The usual options aren't great:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Full runtime (Python/Node.js):&lt;/strong&gt; easy to set up, hard to lock down properly. Restricting it after the fact is whack-a-mole.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker per agent:&lt;/strong&gt; proper isolation, but ~200ms cold start and 100MB+ RAM each. At 50 concurrent agents that's 5GB just idling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We wanted something lighter. Not "restricted Python" — something designed from scratch for how AI actually writes code.&lt;/p&gt;

&lt;h2&gt;
  
  
  AI code has a specific profile
&lt;/h2&gt;

&lt;p&gt;After running a lot of agent scripts in production, the pattern is pretty consistent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Under 100 lines almost always&lt;/li&gt;
&lt;li&gt;Runs frequently, not once&lt;/li&gt;
&lt;li&gt;Doesn't need filesystem, network, or OS access&lt;/li&gt;
&lt;li&gt;Tends to produce infinite loops, wrong types, null accesses&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;General-purpose languages aren't built for this. So we built &lt;strong&gt;Autolang&lt;/strong&gt; — a small scripting VM where AI can only call functions you explicitly registered. Nothing else is reachable.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AI writes Autolang script
    → static compiler validates types and scope
        → your registered JS / C++ functions do the actual work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You wrap your existing functions as bindings. The AI calls those. That's it. It can't reach outside what you've registered.&lt;/p&gt;

&lt;p&gt;Here's a real example — register a database binding:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;compiler&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;registerBuiltInLibrary&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;company/products&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;`
  class Product (val name: String, val price: Int, val inStock: Bool)
  class Database {
    @native("get_products")
    static func get_products(): Array&amp;lt;Product&amp;gt;
  }
`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;autoImport&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;get_products&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;fetchFromYourDB&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The AI then writes something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"company/products"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;affordable&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Database&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_products&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt; &lt;span class="p"&gt;{|&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;inStock&lt;/span&gt; &lt;span class="p"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;affordable&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt; &lt;span class="p"&gt;{|&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="nf"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"- ${p.name}: $${p.price}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It can't touch anything outside &lt;code&gt;company/products&lt;/code&gt;. If it writes an infinite loop, the opcode limit kills it before it hangs your process.&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Native&lt;/th&gt;
&lt;th&gt;npm&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cold start&lt;/td&gt;
&lt;td&gt;~10ms&lt;/td&gt;
&lt;td&gt;~20ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Warm start&lt;/td&gt;
&lt;td&gt;1–2ms&lt;/td&gt;
&lt;td&gt;2–4ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RAM per instance&lt;/td&gt;
&lt;td&gt;~4MB&lt;/td&gt;
&lt;td&gt;~12MB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;50 concurrent agents: ~200MB total. Docker would be 5GB+.&lt;/p&gt;

&lt;h2&gt;
  
  
  When it makes sense
&lt;/h2&gt;

&lt;p&gt;Good fit if you're running 5+ concurrent agents, scripts are short and frequent, and you want controlled access to existing functions without rewriting them.&lt;/p&gt;

&lt;p&gt;Probably not worth it if you have only a handful of agents, need OS-level security guarantees, need Python bindings (not ready yet), or your AI writes long complex programs.&lt;/p&gt;






&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;autolang-compiler
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Github: &lt;a href="https://github.com/hoansdz/Autolang" rel="noopener noreferrer"&gt;https://github.com/hoansdz/Autolang&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Philosophy: &lt;a href="//autolang.vercel.app/docs/philosophy-vision"&gt;autolang.vercel.app/docs/philosophy-vision&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Live editor: &lt;a href="//autolang.vercel.app/docs/editor"&gt;autolang.vercel.app/docs/editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Curious how others are handling this. What's your current setup for sandboxed agent code?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>cpp</category>
      <category>llm</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
