Client for interacting with the Sandbox Server API.
This client provides a simple interface for managing sandboxes and templates.
class SandboxClientimport { 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();
}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 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).