SDK
Interpreters

Interpreters

The Interpreter API allows you to run code in different programming languages in your sandbox.

API

The Interpreter API is available under sandbox.interpreters.

Running Code

The Interpreter API includes built-in support for running code in different programming languages:

const sandbox = await sdk.sandboxes.create()
const session = await sandbox.connect()
 
// Run JavaScript code
const jsResult = await session.interpreters.javascript("'Hello from Node.js!'");
 
// Run Python code
const pythonResult = await session.interpreters.python("'Hello from Python!'");

These interpreters will automatically return the last expression as output, but you can print values to the console at any point for multiple outputs.

💡

Note that the interpreters will not resolve until the interpretation resolves. We are open to changing this behavior if you have any feedback or suggestions! Or you can always wield your own by using commands.