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
  • Traceable
  • Jestlike
  • Vercel
  • Anthropic
  • Sandbox
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangSmith
ClientRun TreesTraceableEvaluationSchemasLangchainJestVitestWrappersAnonymizerTraceableJestlikeVercelAnthropicSandbox
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
id: string

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

property
name: string

Display name (can be updated).

property
template_name: string

Name of the template used to create this sandbox.

property
updated_at: string

Timestamp when the sandbox was last updated.

Methods

method
delete→ Promise<void>

Delete this sandbox.

Call this when you're done using the sandbox to clean up resources.

method
read→ Promise<Uint8Array<ArrayBufferLike>>

Read a file from the sandbox.

method
run→ Promise<ExecutionResult>

Execute a command in the sandbox.

method
write→ Promise<void>

Write content to a file in the sandbox.

View source on GitHub