Skip to main content
Command output can be streamed in real time by providing onStdout and onStderr callbacks to commands.run() in JavaScript, or on_stdout and on_stderr callbacks in Python.
import { Sandbox } from 'novita-sandbox/code-interpreter'

const sandbox = await Sandbox.create()
const result = await sandbox.commands.run('echo hello; sleep 1; echo world', {
  onStdout: (data) => {
    console.log(data)
  },
  onStderr: (data) => {
    console.log(data)
  },
})

console.log(result)

await sandbox.kill()
Last modified on June 4, 2026