Start and Ready Commands

Updated at:

To run a long-lived process such as a web service in a sandbox, start it with a background command after creating the sandbox.

Python example:

server = sandbox.commands.run(
    "python3 -m http.server 8000",
    background=True,
)

host = sandbox.get_host(8000)
print(f"https://{host}")

TypeScript example:

const server = await sandbox.commands.run("python3 -m http.server 8000", {
  background: true,
});

const host = sandbox.getHost(8000);
console.log(`https://${host}`);