Skip to content

Runtime

Control lifecycle, commands, files, networking, secrets, and checkpoints for one runtime.

class Runtime

This type is created by the SDK; do not construct it directly.

const runtime = await client.runtimes.create();
const runtime = await client.runtimes.get("runtime-id");
Name Type Description
cachedInfo RuntimeInfo Most recently fetched runtime metadata.
checkpoints RuntimeCheckpointManager Checkpoint manager for this runtime.
displayName string Runtime display name.
egress EgressManager Egress policy manager for this runtime.
files FileManager File manager for this runtime.
id string Runtime UUID.
name string Runtime display name.
secrets RuntimeSecretManager Secret-stub manager for this runtime.

Boot the runtime and optionally wait until it is ready.

Runtime.boot(options: LifecycleOptions = {}): Promise<void>
Name Type Default Description
options LifecycleOptions {} Readiness polling options.
  • Promise<void>
const runtime = await client.runtimes.get("worker");
await runtime.boot();
console.log(await runtime.status());

Delete the runtime.

Runtime.delete(): Promise<void>
  • Promise<void>

Run a command and return its buffered output.

Runtime.exec(command: string | readonly string[], options: ExecOptions = {}): Promise<CommandResult>
Name Type Default Description
command string | readonly string[] Required Shell command or argument sequence to execute.
options ExecOptions {} Command environment, input, timeout, and output limits.
  • Promise<CommandResult> — The command exit code and buffered output.
  • ApiError If execution cannot be started or completed.
const result = await runtime.exec("python --version");
console.log(result.stdoutText);

Start a command without waiting for its output.

Runtime.execDetached(
command: string | readonly string[],
options: ExecOptions = {},
): Promise<CommandResult>
Name Type Default Description
command string | readonly string[] Required Shell command or argument sequence to execute.
options ExecOptions {} Options that control the operation.
  • Promise<CommandResult>

Alias for Runtime.status.

Runtime.heartbeat(): Promise<RuntimeStatus>
  • Promise<RuntimeStatus>

Pause the runtime.

Runtime.pause(): Promise<void>
  • Promise<void>

Refresh and return runtime metadata from the API.

Runtime.refreshInfo(): Promise<RuntimeInfo>
  • Promise<RuntimeInfo>

Change the runtime memory limit in MiB.

Runtime.resizeMemory(newMemoryMib: number): Promise<RuntimeInfo>
Name Type Default Description
newMemoryMib number Required New runtime memory limit in MiB.
  • Promise<RuntimeInfo>

Create a runtime from one of this runtime’s checkpoints.

Runtime.restore(
checkpointId: string,
options: CreateRuntimeOptions & { name?: string | null } = {},
): Promise<Runtime>
Name Type Default Description
checkpointId string Required Checkpoint UUID used by the operation.
options CreateRuntimeOptions & { name?: string | null } {} Options that control the operation.
  • Promise<Runtime>

Resume the runtime and optionally wait until it is ready.

Runtime.resume(options: LifecycleOptions = {}): Promise<void>
Name Type Default Description
options LifecycleOptions {} Options that control the operation.
  • Promise<void>

Shut down the runtime.

Runtime.shutdown(): Promise<void>
  • Promise<void>

Fetch the current runtime lifecycle status.

Runtime.status(): Promise<RuntimeStatus>
  • Promise<RuntimeStatus>

Change the idle duration before automatic suspension.

Runtime.updateIdleSuspendAfterSecs(idleSuspendAfterSecs: number | null): Promise<RuntimeInfo>
Name Type Default Description
idleSuspendAfterSecs number | null Required Idle time before automatic suspension, or null to disable it.
  • Promise<RuntimeInfo>

Update the runtime resource configuration.

Runtime.updateResources(resources: PatchRuntimeResources | Record<string, unknown>): Promise<RuntimeInfo>
Name Type Default Description
resources PatchRuntimeResources | Record<string, unknown> Required Runtime resource requests and limits.
  • Promise<RuntimeInfo>

Wait until the runtime reaches the running state.

Runtime.waitUntilReady(options: WaitOptions = {}): Promise<RuntimeInfo>
Name Type Default Description
options WaitOptions {} Options that control the operation.
  • Promise<RuntimeInfo>