# AsyncSandboxClient

> **Class** in `langsmith`

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

Async client for interacting with the Sandbox Server API.

This client provides an async interface for managing sandboxes and snapshots.

## Signature

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

## Description

**Example:**

# Uses LANGSMITH_ENDPOINT and LANGSMITH_API_KEY from environment
async with AsyncSandboxClient() as client:
    # Create a sandbox with the default runtime and run commands
    async with await client.sandbox() as sandbox:
        result = await 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`) |
| `headers` | `Optional[Mapping[str, str]]` | No | Optional default headers attached to every request on this      client, including the data-plane ``/execute`` HTTP endpoint      and the ``/execute/ws`` WebSocket upgrade. Use this to pass      additional auth headers (e.g. ``X-Service-Key``). (default: `None`) |

## Constructors

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

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


## Properties

- `registries`

## Methods

- [`to_sync()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/to_sync)
- [`aclose()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/aclose)
- [`sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/sandbox)
- [`create_sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/create_sandbox)
- [`get_sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/get_sandbox)
- [`list_sandboxes()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/list_sandboxes)
- [`update_sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/update_sandbox)
- [`delete_sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/delete_sandbox)
- [`get_sandbox_status()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/get_sandbox_status)
- [`service()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/service)
- [`wait_for_sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/wait_for_sandbox)
- [`start_sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/start_sandbox)
- [`stop_sandbox()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/stop_sandbox)
- [`create_snapshot()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/create_snapshot)
- [`create_snapshot_from_dockerfile()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/create_snapshot_from_dockerfile)
- [`capture_snapshot()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/capture_snapshot)
- [`get_snapshot()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/get_snapshot)
- [`list_snapshots()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/list_snapshots)
- [`delete_snapshot()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/delete_snapshot)
- [`wait_for_snapshot()`](https://reference.langchain.com/python/langsmith/sandbox/_async_client/AsyncSandboxClient/wait_for_snapshot)

---

[View source on GitHub](https://github.com/langchain-ai/langsmith-sdk/blob/687fc8d527a28504432f52bd08c75f2894c209fe/python/langsmith/sandbox/_async_client.py#L73)