Skip to content

Commit d36b7e9

Browse files
committed
Update sandbox.md
1 parent a75998b commit d36b7e9

1 file changed

Lines changed: 33 additions & 29 deletions

File tree

docs/sandbox.md

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -981,10 +981,10 @@ def create(cls,
981981
image: str = "koyeb/sandbox",
982982
name: str = "quick-sandbox",
983983
wait_ready: bool = True,
984-
instance_type: str = "nano",
984+
instance_type: str = "micro",
985985
exposed_port_protocol: Optional[str] = None,
986986
env: Optional[Dict[str, str]] = None,
987-
regions: Optional[List[str]] = None,
987+
region: Optional[str] = None,
988988
api_token: Optional[str] = None,
989989
timeout: int = 300,
990990
idle_timeout: Optional[IdleTimeout] = None,
@@ -1004,7 +1004,7 @@ Create a new sandbox instance.
10041004
If None, defaults to "http".
10051005
If provided, must be one of "http" or "http2".
10061006
- `env` - Environment variables
1007-
- `regions` - List of regions to deploy to (default: ["na"])
1007+
- `region` - Region to deploy to (default: "na")
10081008
- `api_token` - Koyeb API token (if None, will try to get from KOYEB_API_TOKEN env var)
10091009
- `timeout` - Timeout for sandbox creation in seconds
10101010
- `idle_timeout` - Idle timeout configuration for scale-to-zero
@@ -1019,6 +1019,12 @@ Create a new sandbox instance.
10191019
**Returns**:
10201020

10211021
- `Sandbox` - A new Sandbox instance
1022+
1023+
1024+
**Raises**:
1025+
1026+
- `ValueError` - If API token is not provided
1027+
- `SandboxTimeoutError` - If wait_ready is True and sandbox does not become ready within timeout
10221028

10231029
<a id="koyeb/sandbox.sandbox.Sandbox.get_from_id"></a>
10241030

@@ -1137,16 +1143,6 @@ This is only available if enable_tcp_proxy=True was set when creating the sandbo
11371143

11381144
Optional[tuple[str, int]]: A tuple of (host, port) or None if unavailable
11391145

1140-
<a id="koyeb/sandbox.sandbox.Sandbox.status"></a>
1141-
1142-
#### status
1143-
1144-
```python
1145-
def status() -> str
1146-
```
1147-
1148-
Get current sandbox status
1149-
11501146
<a id="koyeb/sandbox.sandbox.Sandbox.is_healthy"></a>
11511147

11521148
#### is\_healthy
@@ -1453,7 +1449,7 @@ async def create(cls,
14531449
instance_type: str = "nano",
14541450
exposed_port_protocol: Optional[str] = None,
14551451
env: Optional[Dict[str, str]] = None,
1456-
regions: Optional[List[str]] = None,
1452+
region: Optional[str] = None,
14571453
api_token: Optional[str] = None,
14581454
timeout: int = 300,
14591455
idle_timeout: Optional[IdleTimeout] = None,
@@ -1473,7 +1469,7 @@ Create a new sandbox instance with async support.
14731469
If None, defaults to "http".
14741470
If provided, must be one of "http" or "http2".
14751471
- `env` - Environment variables
1476-
- `regions` - List of regions to deploy to (default: ["na"])
1472+
- `region` - Region to deploy to (default: "na")
14771473
- `api_token` - Koyeb API token (if None, will try to get from KOYEB_API_TOKEN env var)
14781474
- `timeout` - Timeout for sandbox creation in seconds
14791475
- `idle_timeout` - Idle timeout configuration for scale-to-zero
@@ -1488,6 +1484,12 @@ Create a new sandbox instance with async support.
14881484
**Returns**:
14891485

14901486
- `AsyncSandbox` - A new AsyncSandbox instance
1487+
1488+
1489+
**Raises**:
1490+
1491+
- `ValueError` - If API token is not provided
1492+
- `SandboxTimeoutError` - If wait_ready is True and sandbox does not become ready within timeout
14911493

14921494
<a id="koyeb/sandbox.sandbox.AsyncSandbox.wait_ready"></a>
14931495

@@ -1547,17 +1549,6 @@ async def delete() -> None
15471549

15481550
Delete the sandbox instance asynchronously.
15491551

1550-
<a id="koyeb/sandbox.sandbox.AsyncSandbox.status"></a>
1551-
1552-
#### status
1553-
1554-
```python
1555-
@async_wrapper("status")
1556-
async def status() -> str
1557-
```
1558-
1559-
Get current sandbox status asynchronously
1560-
15611552
<a id="koyeb/sandbox.sandbox.AsyncSandbox.is_healthy"></a>
15621553

15631554
#### is\_healthy
@@ -1782,7 +1773,9 @@ Build environment variables list from dictionary.
17821773
#### create\_docker\_source
17831774

17841775
```python
1785-
def create_docker_source(image: str, command_args: List[str]) -> DockerSource
1776+
def create_docker_source(image: str,
1777+
command_args: List[str],
1778+
privileged: Optional[bool] = None) -> DockerSource
17861779
```
17871780

17881781
Create Docker source configuration.
@@ -1791,6 +1784,7 @@ Create Docker source configuration.
17911784

17921785
- `image` - Docker image name
17931786
- `command_args` - Command and arguments to run (optional, empty list means use image default)
1787+
- `privileged` - If True, run the container in privileged mode (default: None/False)
17941788

17951789

17961790
**Returns**:
@@ -1866,7 +1860,7 @@ def create_deployment_definition(
18661860
env_vars: List[DeploymentEnv],
18671861
instance_type: str,
18681862
exposed_port_protocol: Optional[str] = None,
1869-
regions: List[str] = None,
1863+
region: Optional[str] = None,
18701864
routes: Optional[List[DeploymentRoute]] = None,
18711865
idle_timeout: Optional[IdleTimeout] = None,
18721866
light_sleep_enabled: bool = True,
@@ -1884,7 +1878,7 @@ Create deployment definition for a sandbox service.
18841878
- `exposed_port_protocol` - Protocol to expose ports with ("http" or "http2").
18851879
If None, defaults to "http".
18861880
If provided, must be one of "http" or "http2".
1887-
- `regions` - List of regions (defaults to ["na"])
1881+
- `region` - Region to deploy to (defaults to "na")
18881882
- `routes` - List of routes for public access
18891883
- `idle_timeout` - Idle timeout configuration (see IdleTimeout type)
18901884
- `light_sleep_enabled` - Whether light sleep is enabled for the instance type (default: True)
@@ -2088,6 +2082,16 @@ class SandboxError(Exception)
20882082

20892083
Base exception for sandbox operations
20902084

2085+
<a id="koyeb/sandbox.utils.SandboxTimeoutError"></a>
2086+
2087+
## SandboxTimeoutError Objects
2088+
2089+
```python
2090+
class SandboxTimeoutError(SandboxError)
2091+
```
2092+
2093+
Raised when a sandbox operation times out
2094+
20912095
<a id="koyeb/sandbox.executor_client"></a>
20922096

20932097
# koyeb/sandbox.executor\_client

0 commit comments

Comments
 (0)