Runtime
Control lifecycle, commands, files, networking, secrets, and checkpoints for one runtime.
Runtime declaration
Section titled “Runtime declaration”class RuntimeRuntime access
Section titled “Runtime access”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");Runtime properties
Section titled “Runtime properties”| 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. |
Runtime methods
Section titled “Runtime methods”boot()
Section titled “boot()”Boot the runtime and optionally wait until it is ready.
Runtime.boot(options: LifecycleOptions = {}): Promise<void>Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
options |
LifecycleOptions |
{} |
Readiness polling options. |
Returns
Section titled “Returns”Promise<void>
Examples
Section titled “Examples”const runtime = await client.runtimes.get("worker");await runtime.boot();console.log(await runtime.status());delete()
Section titled “delete()”Delete the runtime.
Runtime.delete(): Promise<void>Returns
Section titled “Returns”Promise<void>
exec()
Section titled “exec()”Run a command and return its buffered output.
Runtime.exec(command: string | readonly string[], options: ExecOptions = {}): Promise<CommandResult>Parameters
Section titled “Parameters”| 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. |
Returns
Section titled “Returns”Promise<CommandResult>— The command exit code and buffered output.
Throws
Section titled “Throws”- ApiError If execution cannot be started or completed.
Examples
Section titled “Examples”const result = await runtime.exec("python --version");console.log(result.stdoutText);execDetached()
Section titled “execDetached()”Start a command without waiting for its output.
Runtime.execDetached( command: string | readonly string[], options: ExecOptions = {},): Promise<CommandResult>Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
command |
string | readonly string[] |
Required |
Shell command or argument sequence to execute. |
options |
ExecOptions |
{} |
Options that control the operation. |
Returns
Section titled “Returns”Promise<CommandResult>
heartbeat()
Section titled “heartbeat()”Alias for Runtime.status.
Runtime.heartbeat(): Promise<RuntimeStatus>Returns
Section titled “Returns”Promise<RuntimeStatus>
pause()
Section titled “pause()”Pause the runtime.
Runtime.pause(): Promise<void>Returns
Section titled “Returns”Promise<void>
refreshInfo()
Section titled “refreshInfo()”Refresh and return runtime metadata from the API.
Runtime.refreshInfo(): Promise<RuntimeInfo>Returns
Section titled “Returns”Promise<RuntimeInfo>
resizeMemory()
Section titled “resizeMemory()”Change the runtime memory limit in MiB.
Runtime.resizeMemory(newMemoryMib: number): Promise<RuntimeInfo>Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
newMemoryMib |
number |
Required |
New runtime memory limit in MiB. |
Returns
Section titled “Returns”Promise<RuntimeInfo>
restore()
Section titled “restore()”Create a runtime from one of this runtime’s checkpoints.
Runtime.restore( checkpointId: string, options: CreateRuntimeOptions & { name?: string | null } = {},): Promise<Runtime>Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
checkpointId |
string |
Required |
Checkpoint UUID used by the operation. |
options |
CreateRuntimeOptions & { name?: string | null } |
{} |
Options that control the operation. |
Returns
Section titled “Returns”Promise<Runtime>
resume()
Section titled “resume()”Resume the runtime and optionally wait until it is ready.
Runtime.resume(options: LifecycleOptions = {}): Promise<void>Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
options |
LifecycleOptions |
{} |
Options that control the operation. |
Returns
Section titled “Returns”Promise<void>
shutdown()
Section titled “shutdown()”Shut down the runtime.
Runtime.shutdown(): Promise<void>Returns
Section titled “Returns”Promise<void>
status()
Section titled “status()”Fetch the current runtime lifecycle status.
Runtime.status(): Promise<RuntimeStatus>Returns
Section titled “Returns”Promise<RuntimeStatus>
updateIdleSuspendAfterSecs()
Section titled “updateIdleSuspendAfterSecs()”Change the idle duration before automatic suspension.
Runtime.updateIdleSuspendAfterSecs(idleSuspendAfterSecs: number | null): Promise<RuntimeInfo>Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
idleSuspendAfterSecs |
number | null |
Required |
Idle time before automatic suspension, or null to disable it. |
Returns
Section titled “Returns”Promise<RuntimeInfo>
updateResources()
Section titled “updateResources()”Update the runtime resource configuration.
Runtime.updateResources(resources: PatchRuntimeResources | Record<string, unknown>): Promise<RuntimeInfo>Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
resources |
PatchRuntimeResources | Record<string, unknown> |
Required |
Runtime resource requests and limits. |
Returns
Section titled “Returns”Promise<RuntimeInfo>
waitUntilReady()
Section titled “waitUntilReady()”Wait until the runtime reaches the running state.
Runtime.waitUntilReady(options: WaitOptions = {}): Promise<RuntimeInfo>Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
options |
WaitOptions |
{} |
Options that control the operation. |
Returns
Section titled “Returns”Promise<RuntimeInfo>
