NewStof 0.10 Enables Safe In-Process Execution of AI-Generated Logic
NewStof 0.10 introduces a safer alternative for executing AI-generated logic within applications by running logic in-process with limited access, reducing risk while maintaining performance.
Safe Execution of AI-Generated Logic
Safe execution of AI-generated logic within an application remains a critical challenge for developers. Traditional approaches such as containers or microVMs introduce overhead and complexity, while using eval in the app can expose the system to risks by allowing the code to access everything the app can. Function calling restricts the model to only the functions already defined, but it cannot add new logic. Similarly, rule DSLs in JSON are limited and awkward for both humans and models to work with, and WebAssembly requires a compiler toolchain and large binaries that are separate from the data they process. NewStof 0.10 introduces a safer alternative by allowing the model to write a document that the app runs like any other data, in-process and in under a millisecond. The logic runs with access only to itself and the functions explicitly provided by the developer, reducing risk while maintaining performance.
Integration and Language Support
The integration and language support for running AI-generated logic within an app is designed to be seamless and flexible. The framework allows developers to embed logic directly into their applications using sandboxed execution in Rust, JavaScript, or Python, without requiring additional processes, servers, or containers. This is achieved by storing both data and logic in a single document, which is then executed in-process by the app. Developers can get started with simple commands such as npm i @formata/stof, cargo add stof, or pip install stof, depending on their preferred language. Editor support is also available through the command-line interface, including features like error detection, code navigation, and renaming in VS Code. According to the documentation, the syntax is accessible to anyone familiar with JSON and JavaScript, and models can also interpret it.
Use Cases and Application Scenarios
Stof enables developers to run AI-generated logic securely within their applications, offering flexibility across different environments. This is particularly useful when logic—such as rules, filters, or scoring mechanisms—needs to be executed consistently in the browser, on a server, or within a worker. By using Stof, teams can update behavior by sending a new document rather than deploying code changes, streamlining the process of modifying application logic. This approach is ideal for scenarios where logic must be dynamic and adaptable without requiring frequent software updates. According to the source, this capability ensures that the same logic produces the same results across all execution contexts, enhancing reliability and reducing maintenance overhead. Developers can leverage this feature to implement complex transformations, user-specific behaviors, or real-time decision-making without compromising security or performance.
Comparison with Alternatives
When comparing alternatives for running AI-generated logic inside an app, each option presents distinct trade-offs. Containers or microVMs offer strong isolation but are heavy, slow to start, and require additional infrastructure for security. Using eval within the app grants the code full access to the app's environment, which can be risky. Function calling restricts the model to only the functions already defined, limiting its ability to add new logic. Rule DSLs in JSON are limited in expressiveness and are awkward for both humans and models to work with. WebAssembly requires a compiler toolchain and results in large binaries, with logic separated from its data. In contrast, Stof allows the model to write a document that the app runs in-process, in under a millisecond, with access limited to itself and the functions provided by the developer.
Implementation and Tooling
Implementation and tooling for running AI-generated logic safely inside your app is streamlined with minimal dependencies. According to Hacker News Show, no server, container, or extra process is required. Developers can integrate the solution using standard package managers: JavaScript and TypeScript with npm i @formata/stof, Rust with cargo add stof, Python with pip install stof, and the command line with cargo install stof-cli. Editor support is available through the CLI, including features like error detection, go to definition, completion, and rename in the VS Code extension. To teach an AI model Stof, developers are directed to read the quickstart guide and view the project on GitHub, as noted in Hacker News Show. Functions written in the main language are provided to Stof documents, which act as the policy engine behind Limitr, enabling pricing documents to be pushed to running apps and evaluated in-process on every call, as described in Hacker News Show.
Sources and reporting notes
Based on published source material. No independent hands-on testing is claimed.