api.compute

exec()

api.compute.exec({ storageId, command, timeoutMs? }) → Promise<ComputeResult>

Run one command in a temporary isolated container and return its output and execution usage.

billed computetemporary container
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

const result = await api.compute.exec({
  storageId: "YOUR_OBJECT_STORAGE_ID",
  command: "npm run build",
  timeoutMs: 120_000,
});
console.log(result.stdout, result.stderr, result.exitCode);
result = api.compute.exec(
    storage_id="YOUR_OBJECT_STORAGE_ID",
    command="npm run build",
    timeout_ms=120_000,
)
print(result["stdout"], result["stderr"], result["exitCode"])
storageIdstringrequired

ID of an Object Storage owned by the signed-in account; it is mounted as /workspace.

commandstringrequired

Command to execute in the isolated container.

timeoutMsinteger

Optional execution timeout in milliseconds, subject to service limits.

Result

The response includes ok, stdout, stderr, exitCode, cpuSeconds and quota information. A non-zero exit code is a completed command result; runner, storage, quota and timeout failures are returned as API errors.

This does not keep a process alive

The container is for this command. Use <a href="/sdk/ref/compute/terminals/create">terminals.create()</a> when you need a process to survive the initial request.