Skip to main content
沙盒功能目前处于私有预览阶段。API 和功能可能会随着我们的迭代而改变。注册等待列表 以获取访问权限。
Before creating a sandbox, you need a template. Templates define the blueprint for sandbox instances, including the container image, resource allocation, and optional configuration like volumes and auth proxy rules. Template list view

What templates define

SettingDescription
Container imageThe Docker image to use (private registries are supported)
Resource capacityCPU, memory, and storage limits
VolumesPersistent storage to attach (optional)
Auth proxy configRules for injecting secrets into outbound requests (optional) — see Auth proxy

Create a template

from langsmith.sandbox import SandboxClient

client = SandboxClient()

client.create_template(
    name="python-sandbox",
    image="python:3.12-slim",
)
You can also create templates via the REST API with full control over resources and proxy configuration:
curl -X POST "$LANGSMITH_ENDPOINT/api/v2/sandboxes/templates" \
  -H "x-api-key: $LANGSMITH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "python-sandbox",
    "image": "python:3.12-slim",
    "resources": {"cpu": "500m", "memory": "512Mi", "storage": "2Gi"}
  }'

Next steps