This page is about the JavaScript interpreter environment inside the Riza Code Interpreter API. If you’re looking to call the API from Node, head over to the API Client Libraries page.

The environment your JavaScript or TypeScript runs in depends on the underlying Riza environment associated with your runtime.

By default JavaScript runs in our highly-performant WASI environment. If you are executing JavaScript in a custom runtime, then your JavaScript runs in our microVM environment unless you’ve opted-in to our new V8 environment (in beta).

Runtime

Within our default WASI environment we run StarlingMonkey compiled to WASM. This is a browser-based runtime that includes most standard browser builtins including fetch, JSON.parse and JSON.stringify. TypeScript transpilation is handled automatically using swc.

In our microVM environment we run Node.js 22.13.0.

To add additional packages from npm, you’ll need to build a custom runtime. See Adding Packages for more information.

Resource limits

There are no limitations beyond the general limits that apply to all Riza interpreter runtime environments.

See our roadmap for planned future improvements.

Standard I/O

You can write to stdout and stderr with the typical console functions. Directly writing to process.stdout or process.stderr will not work within the default WASI environment, but does work within our microVM environment.

console.log("Hello, World!");
console.dir({"foo": "bar"});
console.error("Something went wrong!");

You can read from process.stdin, process.argv and process.env to get input data. Note that process.stdin is just a string in our WASI environment, not a stream as it is in our microVM and V8 environments.

// Read from stdin
const input = await new Response(process.stdin).text();

// Read from argv
process.argv.forEach((a) => ...);

// Read from env
console.log(JSON.stringify(process.env));

Also note that within the WASI environment process.argv has two system arguments in the array before user-supplied arguments, rather than one.

Files

The filesystem is read-only in all environments.

You can pass input files via the API using the files parameter in the WASI and V8 environments. This feature is not yet available in the microVM environment.

See the Files reference for more details.

Accessing the network

Network access is blocked by default, so you need to allow traffic to individual hosts using the http request parameter. See the HTTP reference for a full example.

In the WASI environment

You can make HTTP requests using fetch. Protocols other than HTTP are not supported, and code can’t access the network directly.

const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({foo: "bar"}),
};
const r = await fetch("https://httpbin.org/post", options);
const data = await r.json();
console.log(data.args.foo);

In the microVM and V8 environments

You can access the network any way you like, but you’ll need to set the (unfortunately named in this context) http request parameter appropriately to allow traffic to specific hosts.

However, note that host-specific network controls are not yet supported in the microVM environment. You can only allow all network traffic.

"http": {"allow": [{"host": "*"}]}