Repository navigation
Add drives to the management client and sandbox - #51
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The drive test can mount before provisioning completes, causing timing-dependent failures, while token-revocation recovery retains the 401 response connection and can fail with PoolTimeout.
2 open issues
What changed in this PR
Adds shared-drive support to the Python SDK’s management and sandbox clients, covering drive lifecycle operations and mounts in running sandboxes. Backend implementation is still pending, as noted in the PR description.
Changes:
- Adds sync and async drive clients with cached token authentication and paginated listing.
- Exposes sandbox mount, unmount, and mount-listing operations.
- Refreshes generated management APIs and adds unit, parity, and end-to-end coverage.
| File | Description |
|---|---|
tests/sandbox/test_parity.py |
Adds drive interface and model parity checks. |
tests/sandbox/test_e2e.py |
Exercises drive lifecycle, mounting, and persistence. |
tests/sandbox/test_drives.py |
Tests sandbox mount operations and errors. |
tests/client/test_drive.py |
Tests drive operations, authentication, and pagination. |
baseten/sandbox/_sandbox.py |
Exposes sync and async drives properties. |
baseten/sandbox/_drives.py |
Implements sandbox drive mounting APIs. |
baseten/sandbox/__init__.py |
Exports sandbox drive types. |
baseten/client/managementapi/_models.py |
Refreshes generated models, including drives. |
baseten/client/managementapi/_client.py |
Refreshes generated endpoints, including drive operations. |
baseten/client/managementapi/__init__.py |
Updates generated model exports. |
baseten/client/_management.py |
Lazily initializes management drive clients. |
baseten/client/_drive.py |
Implements drive operations and token authentication. |
baseten/client/__init__.py |
Exports public drive clients and types. |
Review effort: Balanced
| if not replayable or retry == _DRIVE_TOKEN_INVALIDATION_MAX_RETRIES: | ||
| return |
There was a problem hiding this comment.
@cretz have you seen this in other clients ?
This might be worth checking
There was a problem hiding this comment.
Yes, I am fixing this one. Other SDKs/CLI confirmed does handle this properly
| labels = {**_LABELS, "step": "update"} | ||
| assert drives.update(name=name, labels=labels).labels == labels | ||
|
|
||
| mounted = sandbox.drives.mount(name=name, mount_path=first_path) |
There was a problem hiding this comment.
Not waiting is intentional (and e2e tests confirm it), see response to similar at basetenlabs/baseten-js#42 (comment)

🚀 What
Note, this is waiting on backend impl and should not be merged as is
ManagementClient.drives/AsyncManagementClient.driveswith create, get, list, update, and delete for drivesSandbox.drives/AsyncSandbox.drivesto mount, unmount, and list drive mounts in a running sandbox💻 How
drivesaccess, sharing one cached token🔬 Testing