LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangSmith
  • Client
  • Run Trees
  • Traceable
  • Evaluation
  • Schemas
  • Langchain
  • Jest
  • Vitest
  • Wrappers
  • Anonymizer
  • Jestlike
  • Vercel
  • Anthropic
  • Sandbox
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangSmith
ClientRun TreesTraceableEvaluationSchemasLangchainJestVitestWrappersAnonymizerJestlikeVercelAnthropicSandbox
Language
Theme
JavaScriptlangsmithexperimentalsandboxSandbox
Class●Since v0.6

Sandbox

Represents an active sandbox for running commands and file operations.

This class is typically obtained from SandboxClient.createSandbox() and provides methods for command execution and file I/O within the sandbox environment.

Copy
class Sandbox

Example

Copy
const sandbox = await client.createSandbox("python-sandbox");
try {
  const result = await sandbox.run("python --version");
  console.log(result.stdout);
} finally {
  await sandbox.delete();
}

Properties

property
created_at: string

Timestamp when the sandbox was created.

property
dataplane_url: string

URL for data plane operations (file I/O, command execution).

property
expires_at: string

Computed expiration timestamp when a TTL is active.

property
id: string

Unique identifier (UUID). Remains constant even if name changes.

property
idle_ttl_seconds: number

Idle timeout TTL in seconds (0 means disabled).

property
name: string

Display name (can be updated).

property
status: string

Provisioning status ("provisioning", "ready", "failed").

property
status_message: string

Human-readable status message (e.g., error details when failed).

property
template_name: string

Name of the template used to create this sandbox.

property
ttl_seconds: number

Maximum lifetime TTL in seconds (0 means disabled).

property
updated_at: string

Timestamp when the sandbox was last updated.

Methods

method
delete→ Promise<void>

Delete this sandbox.

method
read→ Promise<Uint8Array<ArrayBufferLike>>

Read a file from the sandbox.

method
reconnect→ Promise<CommandHandle>

Reconnect to this command from the last known offsets.

Returns a new CommandHandle that resumes output from where this one left off.

method
run→ Promise<CommandHandle>

Execute a command in the sandbox.

When wait is true (default) and no streaming callbacks are provided, tries WebSocket first and falls back to HTTP POST.

When wait is false or streaming callbacks are provided, uses WebSocket (required). Returns a CommandHandle for streaming output.

method
write→ Promise<void>

Write content to a file in the sandbox.

View source on GitHub