The Code Interpreter API lets you execute untrusted code in a few lines of code.

import Riza from '@riza-io/api';

const riza = new Riza();

async function main() {
  const resp = await riza.command.exec({
    language: "PYTHON",
    code: "print('Hello, world!')",


But how do we actually safely execute that code? Here’s a brief explanation of how it works.


Receive request

Your application makes a request to with the code to execute and any input data.


Validate data

We validate that the incoming code and data don’t violate resource limits.


Load WebAssembly

We load the compiled WebAssembly binary for the selected interpreter into memory. For most requests this step is cached.


Create WebAssembly module

We instantiate a new WebAssembly module for the loaded interpreter. We set stdin, command line arguments and environment variables, and configure runtime resource limits.


Execute code

We execute the provided code from your request in the selected interpreter.


Return response

We return stdout and stderr from the execution, along with the program’s exit code.