# SandboxClient

> **Class** in `langsmith`

📖 [View in docs](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient)

Client for interacting with the Sandbox Server API.

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

## Signature

```python
SandboxClient(
    self,
    *,
    api_endpoint: Optional[str] = None,
    timeout: float = 10.0,
    api_key: Optional[str] = None,
    max_retries: int = 3,
    headers: Optional[RequestHeaders] = None,
)
```

## Description

**Example:**

# Uses LANGSMITH_ENDPOINT and LANGSMITH_API_KEY from environment
client = SandboxClient()

# Or with explicit configuration
client = SandboxClient(
    api_endpoint="https://api.smith.langchain.com/v2/sandboxes",
    api_key="your-api-key",
)

# Create a sandbox and run commands
with client.sandbox(template_name="python-sandbox") as sandbox:
    result = sandbox.run("python --version")
    print(result.stdout)

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `api_endpoint` | `Optional[str]` | No | Full URL of the sandbox API endpoint. If not provided,           derived from LANGSMITH_ENDPOINT environment variable. (default: `None`) |
| `timeout` | `float` | No | Default HTTP timeout in seconds. (default: `10.0`) |
| `api_key` | `Optional[str]` | No | API key for authentication. If not provided, uses      LANGSMITH_API_KEY environment variable. (default: `None`) |
| `max_retries` | `int` | No | Maximum number of retries for transient errors (502, 503,          504), rate limits (429), and connection failures. Set to 0          to disable retries. Default: 3. (default: `3`) |

## Constructors

```python
__init__(
    self,
    *,
    api_endpoint: Optional[str] = None,
    timeout: float = 10.0,
    api_key: Optional[str] = None,
    max_retries: int = 3,
    headers: Optional[RequestHeaders] = None,
)
```

| Name | Type |
|------|------|
| `api_endpoint` | `Optional[str]` |
| `timeout` | `float` |
| `api_key` | `Optional[str]` |
| `max_retries` | `int` |
| `headers` | `Optional[RequestHeaders]` |


## Methods

- [`close()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/close)
- [`create_volume()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/create_volume)
- [`get_volume()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/get_volume)
- [`list_volumes()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/list_volumes)
- [`delete_volume()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/delete_volume)
- [`update_volume()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/update_volume)
- [`create_template()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/create_template)
- [`get_template()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/get_template)
- [`list_templates()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/list_templates)
- [`update_template()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/update_template)
- [`delete_template()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/delete_template)
- [`create_pool()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/create_pool)
- [`get_pool()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/get_pool)
- [`list_pools()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/list_pools)
- [`update_pool()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/update_pool)
- [`delete_pool()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/delete_pool)
- [`sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/sandbox)
- [`create_sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/create_sandbox)
- [`get_sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/get_sandbox)
- [`list_sandboxes()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/list_sandboxes)
- [`update_sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/update_sandbox)
- [`delete_sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/delete_sandbox)
- [`get_sandbox_status()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/get_sandbox_status)
- [`service()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/service)
- [`wait_for_sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/wait_for_sandbox)
- [`start_sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/start_sandbox)
- [`stop_sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/stop_sandbox)
- [`create_snapshot()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/create_snapshot)
- [`capture_snapshot()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/capture_snapshot)
- [`get_snapshot()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/get_snapshot)
- [`list_snapshots()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/list_snapshots)
- [`delete_snapshot()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/delete_snapshot)
- [`wait_for_snapshot()`](https://reference.langchain.com/python/langsmith/sandbox/_client/SandboxClient/wait_for_snapshot)

---

[View source on GitHub](https://github.com/langchain-ai/langsmith-sdk/blob/cc54cc2729bb1cfe402fd9f34cf953de60bde30c/python/langsmith/sandbox/_client.py#L60)