Import
import {
createAgentServiceSandboxClient,
createAgentServiceSandboxTools,
createHostedSandboxClient,
createHostedSandboxTools,
createSandboxShellTools,
normalizeBashToolSet,
} from "veryfront/sandbox";Examples
import { Sandbox } from "veryfront/sandbox";
const sandbox = await Sandbox.create();
const result = await sandbox.runCommand("echo hello");
console.log(result.stdout); // "hello\n"
await sandbox.close();API
Sandbox.create()
Create an isolated sandbox workspace.
Returns: <code>Promise<Sandbox></code>
Sandbox.get(id, )
Reconnect to an existing sandbox session.
Returns: <code>Promise<Sandbox></code>
Sandbox.attach(attachment)
Attach to an existing sandbox. Closing detaches; use delete() to remove it.
Returns: Sandbox
Sandbox.capabilities()
Get platform features or selected-project creation eligibility. Creation rechecks capacity.
Returns: <code>Promise<SandboxCapabilities></code>
sandbox.checkHealth()
Check runtime health without recording activity.
Returns: <code>Promise<SandboxRuntimeCheck></code>
sandbox.checkReadiness()
Check command readiness without recording activity.
Returns: <code>Promise<SandboxRuntimeCheck></code>
sandbox.getEnvironment()
Get environment variable names with redacted values.
Returns: <code>Promise<SandboxEnvironment></code>
sandbox.listFiles()
Read one directory page. Supply pageInfo.next as cursor for another page.
Returns: <code>Promise<SandboxFileListResult></code>
sandbox.updateLifetime(input)
Update cleanup policy without changing access or storage.
Returns: <code>Promise<SandboxDetails></code>
Sandbox.list()
List sandboxes with optional pagination.
Returns: <code>Promise<SandboxListResult></code>
Sandbox.createLazy()
Create a client that provisions its sandbox when first used.
Returns: LazySandbox
sandbox.runCommand(command, options)
Execute a bash command in the sandbox and return buffered stdout/stderr plus the exit code.
Returns: <code>Promise<CommandResult></code>
sandbox.streamCommand(command, options)
Execute a bash command in the sandbox and stream newline-delimited JSON (NDJSON) output events as they arrive.
Returns: <code>AsyncGenerator<CommandStreamEvent></code>
sandbox.readFile(path)
Read a file from the sandbox workspace.
Returns: <code>Promise<string></code>
sandbox.writeFiles(files, options)
Write one or more files to the sandbox workspace.
Returns: <code>Promise<void></code>
sandbox.startBackgroundCommand(command, options)
Start an async background command in the sandbox.
Returns: <code>Promise<BackgroundCommand></code>
sandbox.getBackgroundCommand(commandId)
Get the status of an async background command.
Returns: <code>Promise<BackgroundCommand></code>
sandbox.getBackgroundCommandOutput(commandId)
Get the output of an async background command.
Returns: <code>Promise<BackgroundCommandOutput></code>
sandbox.listBackgroundCommands()
List all background commands in the sandbox.
Returns: <code>Promise<BackgroundCommand[]></code>
sandbox.cancelBackgroundCommand(commandId, )
Cancel an async background command.
Returns: <code>Promise<BackgroundCommand></code>
sandbox.heartbeat()
Record activity for idle cleanup. Fixed expiry does not change.
Returns: <code>Promise<void></code>
sandbox.close()
Close the client. Existing and persistent sandboxes remain; temporary sandboxes created by this client are deleted.
Returns: <code>Promise<void></code>
sandbox.delete()
Delete the sandbox and its workspace files.
Returns: <code>Promise<void></code>
sandbox.id
Get the sandbox ID.
Returns: string
sandbox.url
Get the sandbox endpoint URL.
Returns: string
Type Reference
SandboxOptions
Options for creating a sandbox.
CommandResult
Result of a command execution: stdout, stderr, and exit code.
CommandStreamEvent
Streaming event emitted during command execution.