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

SandboxClient

Client for interacting with the Sandbox Server API.

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

Copy
class SandboxClient

Example

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();
}

Constructors

constructor
constructor

Methods

method
createPool→ Promise<Pool>

Create a new Sandbox Pool.

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

method
createSandbox→ Promise<Sandbox>

Create a new Sandbox.

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

method
createTemplate→ Promise<SandboxTemplate>

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.

method
createVolume→ Promise<Volume>

Create a new persistent volume.

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

method
deletePool→ Promise<void>

Delete a Pool.

This will terminate all sandboxes in the pool.

method
deleteSandbox→ Promise<void>

Delete a Sandbox.

method
deleteTemplate→ Promise<void>

Delete a SandboxTemplate.

method
deleteVolume→ Promise<void>

Delete a volume.

method
getPool→ Promise<Pool>

Get a Pool by name.

method
getSandbox→ Promise<Sandbox>

Get a Sandbox by name.

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

method
getTemplate→ Promise<SandboxTemplate>

Get a SandboxTemplate by name.

method
getVolume→ Promise<Volume>

Get a volume by name.

method
listPools→ Promise<Pool[]>

List all Pools.

method
listSandboxes→ Promise<Sandbox[]>

List all Sandboxes.

method
listTemplates→ Promise<SandboxTemplate[]>

List all SandboxTemplates.

method
listVolumes→ Promise<Volume[]>

List all volumes.

method
updatePool→ Promise<Pool>

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.

method
updateSandbox→ Promise<Sandbox>

Update a sandbox's display name.

method
updateTemplate→ Promise<SandboxTemplate>

Update a template.

method
updateVolume→ Promise<Volume>

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).

View source on GitHub