Skip to main content
Sandboxes are isolated environments that allow agents to safely execute potentially risky operations, like running arbitrary code or interacting with the filesystem, without affecting your main infrastructure. From the LangSmith homepage, select Sandboxes to manage all your sandbox resources. Sandboxes overview page

Environment availability

EnvironmentStatus
GCP US (smith.langchain.com)Generally available
GCP EU (eu.smith.langchain.com)Generally available
GCP APAC (apac.smith.langchain.com)Generally available
AWS US (aws.smith.langchain.com)Generally available

Get started

1. Install the SDK

# uv
uv add "langsmith[sandbox]"

# pip
pip install "langsmith[sandbox]"

2. Set your API key

export LANGSMITH_API_KEY="<your-api-key>"

3. Create and run a sandbox

from langsmith.sandbox import SandboxClient

client = SandboxClient()

with client.sandbox() as sb:
    result = sb.run("python -c 'print(2 + 2)'")
    print(result.stdout)  # "4\n"
Prefer the command line? The Sandbox CLI lets you create sandboxes, run commands, and open interactive shells without writing any code.

4. Use sandboxes with your agents

To wire sandboxes into agent code, see the Open Source docs:

Resources

Snapshots

Build filesystem images from Docker images or capture a running sandbox, then boot sandboxes from them.

Service URLs

Access HTTP services running inside sandboxes via authenticated URLs.

Auth proxy

Inject credentials into outbound API requests without hardcoding secrets.

Mounts

Attach S3 buckets, GCS buckets, and public Git repositories to a sandbox filesystem.

Permissions

Control which workspace members can interact with a sandbox after it is created.

CLI

Build snapshots, manage sandboxes, open consoles, and tunnel TCP ports from the command line.

SDK usage

Create and manage sandboxes programmatically with the Python or TypeScript SDK.

Harbor

Run Harbor evaluations and rollouts on LangSmith sandboxes.