The Code Interpreter API is shutting down on October 1st, 2025. Read more here.
import Riza from '@riza-io/api';
// Untrusted Python code, either written by
// a customer or a LLM.
const python = `
import sys
import os
if 'DEBUG' in os.environ:
print('Reversing string...', file=sys.stderr)
stdin = sys.stdin.read()
print("".join(reversed(stdin)))
`;
const riza = new Riza();
async function main() {
const resp = await riza.command.exec({
language: "python",
code: python,
stdin: "Hello",
env: {
"DEBUG": "true",
}
});
console.dir(resp, {depth: null});
}
main();
{
"exit_code": 0,
"stdout": "olleH",
"stderr": "Reversing string..."
}
Run a script in a secure, isolated environment. Scripts can read from stdin and write to stdout or stderr. They can access input files, environment variables and command line arguments.
import Riza from '@riza-io/api';
// Untrusted Python code, either written by
// a customer or a LLM.
const python = `
import sys
import os
if 'DEBUG' in os.environ:
print('Reversing string...', file=sys.stderr)
stdin = sys.stdin.read()
print("".join(reversed(stdin)))
`;
const riza = new Riza();
async function main() {
const resp = await riza.command.exec({
language: "python",
code: python,
stdin: "Hello",
env: {
"DEBUG": "true",
}
});
console.dir(resp, {depth: null});
}
main();
{
"exit_code": 0,
"stdout": "olleH",
"stderr": "Reversing string..."
}
Documentation Index
Fetch the complete documentation index at: https://docs.riza.io/llms.txt
Use this file to discover all available pages before exploring further.
import Riza from '@riza-io/api';
// Untrusted Python code, either written by
// a customer or a LLM.
const python = `
import sys
import os
if 'DEBUG' in os.environ:
print('Reversing string...', file=sys.stderr)
stdin = sys.stdin.read()
print("".join(reversed(stdin)))
`;
const riza = new Riza();
async function main() {
const resp = await riza.command.exec({
language: "python",
code: python,
stdin: "Hello",
env: {
"DEBUG": "true",
}
});
console.dir(resp, {depth: null});
}
main();
{
"exit_code": 0,
"stdout": "olleH",
"stderr": "Reversing string..."
}
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The code to execute.
The interpreter to use when executing code.
python, javascript, typescript, ruby, php List of command line arguments to pass to the script.
Set of key-value pairs to add to the script's execution environment.
Show child attributes
List of input files.
Show child attributes
Configuration for HTTP requests and authentication.
Show child attributes
Configuration for execution environment limits.
Show child attributes
The ID of the runtime revision to use when executing code.
Input made available to the script via 'stdin'.
OK
The execution time of the script in milliseconds.
The exit code returned by the script. Will often be '0' on success and non-zero on failure.
The ID of the execution.
The contents of 'stderr' after executing the script.
The contents of 'stdout' after executing the script.