Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Error codes are as follows:

Certain errors are automatically retried 5 times by default, with a short exponential backoff.
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
429 Rate Limit, and >=500 Internal errors are all retried by default for GET requests. For POST requests, only
429 Rate Limit, and >=500 Internal errors are all retried by default for GET requests. For POST requests, only
429 errors will be retried.

You can use the `max_retries` option to configure or disable retry settings:
Expand All @@ -265,6 +265,35 @@ client = Runloop(
client.with_options(max_retries=10).devboxes.create()
```

#### File Write Rate Limiting

File write operations (`write_file_contents` and `upload_file`) are subject to rate limiting on the backend
(approximately 80 chunks per second, equivalent to ~10MB/sec per connection). When rate limits are exceeded,
the API returns a `429 Too Many Requests` error, which is automatically retried with exponential backoff.

The retry behavior includes:
- **Default retries**: 5 attempts (initial request + 4 retries)
- **Backoff strategy**: Exponential with jitter to prevent thundering herd
- **Retry-After header**: Respected when provided by the API
- **Configurable**: Use `max_retries` parameter to adjust retry behavior

Example:
```python
from runloop_api_client import Runloop

client = Runloop(
bearer_token="your-api-key",
max_retries=5 # Recommended for file operations
)

# Automatically retries on rate limit errors
result = client.devboxes.write_file_contents(
id="devbox-id",
contents="large file content...",
file_path="/path/to/file.txt"
)
```

### Timeouts

By default requests time out after 30 seconds. You can configure this with a `timeout` option,
Expand Down
12 changes: 10 additions & 2 deletions src/runloop_api_client/resources/devboxes/devboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ def execute(
id: str,
*,
command: str,
command_id: str,
command_id: str = str(uuid7()),
optimistic_timeout: Optional[int] | Omit = omit,
shell_name: Optional[str] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
Expand Down Expand Up @@ -897,6 +897,7 @@ def execute_async(
)

@typing_extensions.deprecated("deprecated")
# Use execute, executeAsync, or executeAndAwaitCompletion instead
def execute_sync(
self,
id: str,
Expand All @@ -915,6 +916,9 @@ def execute_sync(
Execute a bash command in the Devbox shell, await the command completion and
return the output.

.. deprecated::
Use execute, executeAsync, or executeAndAwaitCompletion instead.

Args:
command: The command to execute via the Devbox shell. By default, commands are run from
the user home directory unless shell_name is specified. If shell_name is
Expand Down Expand Up @@ -2161,7 +2165,7 @@ async def execute(
id: str,
*,
command: str,
command_id: str,
command_id: str = str(uuid7()),
optimistic_timeout: Optional[int] | Omit = omit,
shell_name: Optional[str] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
Expand Down Expand Up @@ -2341,6 +2345,7 @@ async def execute_async(
)

@typing_extensions.deprecated("deprecated")
# Use execute, executeAsync, or executeAndAwaitCompletion instead
async def execute_sync(
self,
id: str,
Expand All @@ -2359,6 +2364,9 @@ async def execute_sync(
Execute a bash command in the Devbox shell, await the command completion and
return the output.

.. deprecated::
Use execute, executeAsync, or executeAndAwaitCompletion instead.

Args:
command: The command to execute via the Devbox shell. By default, commands are run from
the user home directory unless shell_name is specified. If shell_name is
Expand Down
Loading
Loading