# create_sandbox

> **Function** in `deepagents_cli`

📖 [View in docs](https://reference.langchain.com/python/deepagents-cli/integrations/sandbox_factory/create_sandbox)

Create or connect to a sandbox of the specified provider.

This is the unified interface for sandbox creation using the
provider abstraction.

## Signature

```python
create_sandbox(
    provider: str,
    *,
    sandbox_id: str | None = None,
    setup_script_path: str | None = None,
) -> Generator[SandboxBackendProtocol, None, None]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `provider` | `str` | Yes | Sandbox provider (`'agentcore'`, `'daytona'`, `'langsmith'`, `'modal'`, `'runloop'`) |
| `sandbox_id` | `str \| None` | No | Optional existing sandbox ID to reuse (default: `None`) |
| `setup_script_path` | `str \| None` | No | Optional path to setup script to run after sandbox starts (default: `None`) |

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/1ae053f347679e58562d2b81eb6d6e6e9bbf0b07/libs/cli/deepagents_cli/integrations/sandbox_factory.py#L83)