LangSmith Sandbox Module.
This module provides sandboxed code execution capabilities through the LangSmith Sandbox API.
import { ... } from "langsmith/experimental/sandbox";import { SandboxClient } from "langsmith/experimental/sandbox";
// Uses LANGSMITH_ENDPOINT and LANGSMITH_API_KEY from environment
const client = new SandboxClient();
const sandbox = await client.createSandbox("python-sandbox");
try {
const result = await sandbox.run("python --version");
console.log(result.stdout);
} finally {
await sandbox.delete();
}Raised when dataplane_url is not available for the sandbox.
This occurs when the sandbox-router URL is not configured for the cluster.
Raised when organization quota limits are exceeded.
Users should contact support@langchain.dev to increase quotas.
Raised when creating a resource that already exists.
Raised when deleting a resource that is still in use.
Raised when updating a resource name to one that already exists.
Raised when a resource is not found.
Raised when an operation times out.
Raised when the API endpoint returns an unexpected error.
For example, this is raised for wrong URL or path.
Raised when authentication fails (invalid or missing API key).
Raised when connection to the sandbox server fails.
Raised when sandbox creation fails.
Base exception for sandbox client errors.
Raised when attempting to interact with a sandbox that is not ready.
Raised when a sandbox operation fails (run, read, write).
Raised when request validation fails.
This includes:
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.
Client for interacting with the Sandbox Server API.
This client provides a simple interface for managing sandboxes and templates.
Options for creating a pool.
Options for creating a sandbox.
Options for creating a template.
Options for creating a volume.
Result of executing a command in a sandbox.
Represents a Sandbox Pool for pre-provisioned sandboxes.
Pools pre-provision sandboxes from a template for faster startup.
Resource specification for a sandbox.
Options for running a command in a sandbox.
Configuration options for the SandboxClient.
Data representing a sandbox instance from the API.
Represents a SandboxTemplate.
Templates define the image, resource limits, and volume mounts for sandboxes.
Options for updating a pool.
Options for updating a template.
Options for updating a volume.
Represents a persistent volume.
Specification for mounting a volume in a sandbox template.