The Riza Code Interpreter API allows you to safely execute untrusted Python, JavaScript, Ruby or PHP in an isolated and secure sandbox, powered by WebAssembly.

Install a Client Library

We publish API client libraries for Python, Node and Go. We’ll use them for this example.

$ npm install @riza-io/api

Get an API Key

All requests to the Riza API require authentication. You can get an API key from the Riza Dashboard.

Once you have an API key, set it as the value of an environment variable named RIZA_API_KEY.

export RIZA_API_KEY="<api-key-contents>"

Say “Hello”

We’ll use Python for this example, but the Code Interpreter API additionally executes code written in JavaScript, TypeScript, Ruby and PHP.

Our first script is familiar to every programmer: printing “Hello, world!“.

print('Hello, world!')

We’ll send this single-line Python script to the Riza API for execution, and print the output. The only required parameters are language and code.

You can use one of our published API client libraries to make this request from Node, Python or Go, or use curl if available in your shell.

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!')",
  });
  console.log(resp.stdout);
}

main();

Each example above should print Hello, world!.

Next Steps