Skip to content

feat(vercel-sandbox): support onResume parameter in Sandbox.get and Sandbox.create#141

Merged
marc-vercel merged 1 commit intonamed-sandboxesfrom
named-sandboxes-on-resume
Apr 9, 2026
Merged

feat(vercel-sandbox): support onResume parameter in Sandbox.get and Sandbox.create#141
marc-vercel merged 1 commit intonamed-sandboxesfrom
named-sandboxes-on-resume

Conversation

@marc-vercel
Copy link
Copy Markdown
Collaborator

@marc-vercel marc-vercel commented Apr 9, 2026

Non-breaking change. Three new integration tests have been added to ensure that the communication between SDK <-> API works properly with the new field.

Support a new parameter, onResume, for Sandbox.get() and Sandbox.create(). This new parameter is a hook with this format:

onResume: (sandbox: Sandbox) => Promise<void>

This hook will only be executed when a new session is created as part of the resume. So, for example, if I run the following code the onResume hook is not going to be called because we are not creating a new session (it is a no-op):

const sandbox = await Sandbox.create();
await Sandbox.get({ name: sandbox.name, resume: true, onResume: (() => {/* Logic here */}) });

But in this case, it will be called:

const sandbox = await Sandbox.create(onResume: (() => {/* Logic here */}) });
await sandbox.stop({ blocking: true });

// The sandbox is stopped and we need to create a new session. `onResume` hook will be called.
await sandbox.runCommand({ ... });

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sandbox Ready Ready Preview, Comment, Open in v0 Apr 9, 2026 9:17am
sandbox-sdk Ready Ready Preview, Comment, Open in v0 Apr 9, 2026 9:17am
sandbox-sdk-ai-example Ready Ready Preview, Comment, Open in v0 Apr 9, 2026 9:17am

Comment thread packages/vercel-sandbox/src/sandbox.ts
@marc-vercel marc-vercel merged commit b9f33af into named-sandboxes Apr 9, 2026
14 checks passed
@marc-vercel marc-vercel deleted the named-sandboxes-on-resume branch April 9, 2026 09:35
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.

2 participants