Skip to main content

Stof answers

Short, direct answers to what people ask about Stof. Each links to the full doc. Not sure Stof fits? Start with Is Stof right for you?. Looking for a specific job? See How do I….

What Stof is​

What is Stof?​

Just-in-time software: data and logic together, in one document that runs anywhere, travels anywhere, and builds itself as it goes. It's a superset of JSON with functions, types, units, schemas, and tests, and your app runs it in a sandbox, inside its own process, in Rust, JavaScript/TypeScript, or Python. See What is Stof?.

Is Stof a programming language?​

It has a language for its functions, but it's a data runtime: a document format where data and logic live together, plus the library that runs it. You don't write apps in Stof. Your app loads documents, runs them, and exports them.

What does "just-in-time software" mean?​

The code that runs, or the HTML that renders, doesn't have to be written and deployed ahead of time. It can be written for one account, user, or request when it's needed (by you, a customer, or a model), parsed into that document, and run with no deploy.

Is JSON valid Stof?​

Yes. Any JSON document is valid Stof, so you can add types and functions to data you already have, and export it back to JSON, YAML, or TOML. See Formats.

Who makes Stof, and what's the license?​

Formata, Inc. Stof was created by CJ Cummings, and it's the engine behind Limitr. It's open source under Apache 2.0.

Safety​

Is it safe to run Stof a model wrote?​

That's what it's built for. A document can only read and change itself and call the functions your app gives it. The file system, network, and environment are off by default, and every call has a time and memory limit. Code from somewhere else can be parsed as untrusted (nothing runs while it parses) and sealed to what you list. See Security and the Sandbox.

What happens if a document loops forever?​

The call fails with an error, and the document keeps working. Every call has a time limit (2 minutes by default) and a memory limit (256 MB by default), and you can change both, or give a sealed part its own. See Limits on every call.

Can a document reach the network?​

Only if your app turns it on, for the hosts it lists.

Intents and AI​

What's an intent?​

A function declared by what it should do: intent fn hello() 'print hello world';. With the AI package as its executor, a model writes the function the first time it's called, and it's only kept once it passes your examples and checks. It runs sealed, with only what you gave it, and after that it's plain Stof with no model. See Intents.

Which models does Stof work with?​

The built-in AI package (@formata/ai) works with OpenAI, Anthropic, and compatible providers, and it does tools, agents, MCP servers, hooks, and intents. See AI in Stof.

Can models write Stof?​

Yes. It reads like JSON and JavaScript, which models already know, and errors point at the exact line with a plain explanation, so a model can fix its own mistakes. For better results, give your agent the Stof skill.

Using it​

Which languages can run Stof?​

Rust (cargo add stof), JavaScript and TypeScript through WebAssembly in Node.js and browsers (npm i @formata/stof), and Python (pip install stof). The same document gives the same result in each. See Install.

How fast is it?​

It runs inside your process, with no server or cold start. A small document parses in well under a millisecond, and calls take microseconds. It's fast for decisions (rules, pricing, validation, tools), not for number crunching over millions of items. See Performance.

How do I send a document somewhere else?​

As Stof text, or as compact binary with blobify('bstf', obj), with its data, functions, and fields as they are now. The other side parses it and gets the same document, in Rust, JavaScript, or Python. What you send is the text itself: fn hello() { pln('hello world'); } is 34 bytes. Stof moves logic and state between machines; it doesn't schedule or coordinate them. See Formats.

Is there tooling?​

The stof command line (stof run, stof test, stof lsp), a VS Code extension, and the playground in your browser. See Tools.

Choosing​

How does Stof compare to Lua, CEL, OPA, or a sandbox like E2B?​

Each one is good at something Stof isn't, and each comparison says when to choose it. In short: Lua is a faster general-purpose embedded language you sandbox yourself, CEL is a single expression that can't loop, OPA answers infrastructure policy questions, and E2B gives an agent a whole machine in the cloud. Stof is a document of data and logic that runs sandboxed in your process and travels anywhere. See Stof, compared.

When shouldn't I use Stof?​

For your application code, heavy number crunching, long-running services, or code that needs a full machine with its packages. See Is Stof right for you?.

Where do I start?​

Try the playground, then the quick start. Questions are welcome on Discord.