Skip to content

Add sandbox previews - #29

Merged
cretz merged 3 commits into
mainfrom
cretz/sandbox-previews
Oct 16, 2026
Merged

cretz merged 3 commits into
mainfrom
cretz/sandbox-previews

Conversation

@cretz

@cretz cretz commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

🚀 What

  • Sandbox previews: expose a sandbox port on an HTTPS URL, public or token-gated

💻 How

  • Regenerated the management client from the latest /v1/spec (adds preview ops)
  • sandbox.previews returns SandboxPreviews / AsyncSandboxPreviews: create, get_info, list, update, delete, create_token, list_tokens, delete_token
  • SandboxPreviewInfo / SandboxPreviewTokenInfo; TTL as timedelta, like other durations
  • Calls fail on a Sandbox from sandbox_from_url (no name)

🔬 Testing

  • Unit tests for request bodies, mapping, pagination, and the no-name error; sync/async and generated-model parity checks
  • test_previews e2e on both clients against staging: private preview rejected without a token, served with one (response and request headers applied), revoked token rejected, switch to public, delete

@cretz
cretz requested review from cploujoux and a balanced review from Copilot October 16, 2026 16:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The public authentication instructions use an unsupported query parameter, preventing private-preview access when followed.

1 open finding
What changed in this PR

Adds public and token-gated HTTPS previews for sandbox ports through the Python SDK.

Changes:

  • Adds synchronous and asynchronous preview and token management.
  • Regenerates management API clients and models.
  • Adds unit, parity, and end-to-end coverage.
File Description
tests/​sandbox/​test_previews.py Tests requests, mapping, pagination, and errors.
tests/​sandbox/​test_parity.py Checks preview API and model parity.
tests/​sandbox/​test_e2e.py Exercises preview access and lifecycle.
scripts/​apigen/​specs/​management.json Adds preview endpoints and schemas.
baseten/​sandbox/​_sandbox.py Exposes sandbox preview managers.
baseten/​sandbox/​_previews.py Implements preview and token management.
baseten/​sandbox/​_common.py Adds management API access to sandbox contexts.
baseten/​sandbox/​_client.py Passes management client and team context.
baseten/​sandbox/​__init__.py Exports preview interfaces and types.
baseten/​client/​managementapi/​_models.py Adds generated preview models.
baseten/​client/​managementapi/​_client.py Adds generated preview operations.
baseten/​client/​managementapi/​__init__.py Exports generated preview models.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread baseten/sandbox/_previews.py
@cretz
cretz merged commit d094c5e into main Oct 16, 2026
11 of 13 checks passed
@cretz
cretz deleted the cretz/sandbox-previews branch October 16, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants