Skip to content

feat(vercel-sandbox,sandbox): support pagination when listing sandboxes, sessions, snapshots#163

Merged
marc-vercel merged 7 commits intonamed-sandboxesfrom
named-sandboxes-pagination
Apr 28, 2026
Merged

feat(vercel-sandbox,sandbox): support pagination when listing sandboxes, sessions, snapshots#163
marc-vercel merged 7 commits intonamed-sandboxesfrom
named-sandboxes-pagination

Conversation

@marc-vercel
Copy link
Copy Markdown
Collaborator

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

Introduce pagination support for the CLI/SDK, so that customers and agents can iterate over existing sandboxes, snapshots and sessions.

CLI

The CLI now supports two new parameters to control the pagination:

  • --limit
  • --cursor

Also, in the list commands that support pagination, we are also returning the More results: ... at the end, so that humans and agents know which commands they should run next if they want to iterate over the results.

> sandboxes list --limit 2
...
More results: sandbox list --limit 2 --cursor eyJvZmZzZXQiOjJ9

> sandbox sessions list my-sandbox --limit 2
...
More results: sandbox sessions list my-sandbox --limit 2 --cursor eyJvZmZzZXQiOjJ9

> sandbox snapshots list --name my-sandbox --limit 2
...
More results: sandbox snapshots list --name my-sandbox --limit 2 --cursor eyJvZmZzZXQiOjJ9

SDK

SDK introduces a small breaking change for the beta customers. When executing any of these methods:

  • await Sandbox.list()
  • await sandbox.listSessions()
  • await sandbox.listSnapshots()
  • await Snapshot.list()

We are going to return an Iterable. To match the previous behavior, you will need to convert these into an array. For example:

const sandboxes = await (await Sandbox.list()).toArray();

If you want to iterate through the results and automatically let the SDK query the pages when required:

const result = await Sandbox.list({ namePrefix: "ci-", limit: 20 });

# Iterate item by item.
for await (const sandbox of result) {
  console.log(sandbox.name, sandbox.status);
}

# Iterate page by page.
for await (const page of result.pages()) {
  console.log(`Got ${page.sandboxes.length} sandboxes, next=${page.pagination.next}`);
}

To support pagination, these previous 4 methods will support two new optional parameters:

  • limit: page size. Maximum is 100.
  • cursor: starting point. The first page is fetched with this cursor; from there the paginator follows pagination.next automatically.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 23, 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 28, 2026 8:25am
sandbox-cli Ready Ready Preview, Comment, Open in v0 Apr 28, 2026 8:25am
sandbox-sdk Ready Ready Preview, Comment, Open in v0 Apr 28, 2026 8:25am
sandbox-sdk-ai-example Ready Ready Preview, Comment, Open in v0 Apr 28, 2026 8:25am
workflow-code-runner Ready Ready Preview, Comment, Open in v0 Apr 28, 2026 8:25am

Comment thread packages/sandbox/src/util/output.ts Outdated
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