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
JavaScriptlangsmithexperimentalsandboxSandboxClient
Class●Since v0.6

SandboxClient

Copy
class SandboxClient

Used in Docs

  • Sandbox auth proxy
  • Sandbox SDK usage
  • Sandbox templates
  • Sandbox warm pools

Constructors

Methods

View source on GitHub

Example

constructor
constructor
method
createPool→ Promise<Pool>
method
createSandbox→ Promise<Sandbox>
method
createTemplate→ Promise<SandboxTemplate>
method
createVolume→ Promise<Volume>
method
deletePool→ Promise<void>
method
deleteSandbox→ Promise<void>
method
deleteTemplate→ Promise<void>
method
deleteVolume→ Promise<void>
method
getPool→ Promise<Pool>
method
getSandbox→ Promise<Sandbox>
method
getSandboxStatus→ Promise<ResourceStatus>
method
getTemplate→ Promise<SandboxTemplate>
method
getVolume→ Promise<Volume>
method
listPools→ Promise<Pool[]>
method
listSandboxes→ Promise<Sandbox[]>
method
listTemplates→ Promise<SandboxTemplate[]>
method
listVolumes→ Promise<Volume[]>
method
updatePool→ Promise<Pool>
method
updateSandbox→ Promise<Sandbox>
method
updateTemplate→ Promise<SandboxTemplate>
method
updateVolume→ Promise<Volume>
method
waitForSandbox→ Promise<Sandbox>

Client for interacting with the Sandbox Server API.

This client provides a simple interface for managing sandboxes and templates.

Create a new Sandbox Pool.

Pools pre-provision sandboxes from a template for faster startup.

Create a new Sandbox.

Remember to call sandbox.delete() when done to clean up resources.

Create a new SandboxTemplate.

Only the container image, resource limits, and volume mounts can be configured. All other container details are handled by the server.

Create a new persistent volume.

Creates a persistent storage volume that can be referenced in templates.

Delete a Pool.

This will terminate all sandboxes in the pool.

Delete a Sandbox.

Delete a SandboxTemplate.

Delete a volume.

Get a Pool by name.

Get a Sandbox by name.

The sandbox is NOT automatically deleted. Use deleteSandbox() for cleanup.

Get the provisioning status of a sandbox.

This is a lightweight endpoint designed for polling during async creation. Use this instead of getSandbox() when you only need the status.

Get a SandboxTemplate by name.

Get a volume by name.

List all Pools.

List all Sandboxes.

List all SandboxTemplates.

List all volumes.

Update a Pool's name and/or replica count.

You can update the display name, replica count, or both. The template reference cannot be changed after creation.

Update a sandbox's display name.

Update a template.

Update a volume's name and/or size.

You can update the display name, size, or both in a single request. Only storage size increases are allowed (storage backend limitation).

Wait for a sandbox to become ready.

Polls getSandboxStatus() until the sandbox reaches "ready" or "failed" status, then returns the full Sandbox object.

Copy
import { SandboxClient } from "langsmith/experimental/sandbox";

// Uses LANGSMITH_ENDPOINT and LANGSMITH_API_KEY from environment
const client = new SandboxClient();

// Or with explicit configuration
const client = new SandboxClient({
  apiEndpoint: "https://api.smith.langchain.com/v2/sandboxes",
  apiKey: "your-api-key",
});

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