feat(js-sandbox): support snapshotName and list filters#2770
Merged
Daniel Kneipp (DanielKneipp) merged 2 commits intomainfrom Apr 22, 2026
Merged
feat(js-sandbox): support snapshotName and list filters#2770Daniel Kneipp (DanielKneipp) merged 2 commits intomainfrom
Daniel Kneipp (DanielKneipp) merged 2 commits intomainfrom
Conversation
Ramon Nogueira (ramon-langchain)
approved these changes
Apr 22, 2026
Ramon Nogueira (ramon-langchain)
approved these changes
Apr 22, 2026
| */ | ||
| async createSandbox( | ||
| snapshotId: string, | ||
| snapshotId?: string, |
Contributor
There was a problem hiding this comment.
optional nit: why not just allow this to be the name too like snapshotIdOrName: string ?
Contributor
Author
There was a problem hiding this comment.
just avoiding the edge case of the name having the format of an uuid
…ilters - Relax `createSandbox(snapshotId, options?)` so `snapshotId` is optional and add a new `snapshotName` field on `CreateSandboxOptions`. Exactly one of the two must be set (validated via `LangSmithValidationError`). The SDK forwards the identifier verbatim on the wire as `snapshot_id` / `snapshot_name`. `snapshotId` stays positional — it is intentionally not duplicated on the options object. - Add a new `ListSnapshotsOptions` type (nameContains / limit / offset / signal) and extend `listSnapshots` to build a URLSearchParams query string only when at least one option is set, preserving the zero-arg URL. - Re-export `ListSnapshotsOptions` from the sandbox public index. - Tests: cover the snapshotName create path, the zero-identifier and both-identifier rejection cases, the listSnapshots zero-arg URL shape, and the filtered URL shape. - README: add snapshotName and listSnapshots examples in the Snapshots section, update the API Reference rows for `createSandbox` and `listSnapshots`, add a `snapshotName` row to the `CreateSandboxOptions` table, and add a new `ListSnapshotsOptions` table. Stacked on top of #2758. Sibling to #2769 (Python). Made-with: Cursor
Document that the backend always paginates with a default page size of 50 and rejects limit values outside [1, 500] and negative offsets. Also note that nameContains is a case-insensitive substring match.
3a3e87c to
4cdccac
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #2758 — extends the snapshot-only sandbox surface so callers can boot from a snapshot name (not just an ID) and so
listSnapshotssupports server-side filtering and pagination.Sibling to the Python SDK change: #2769.
createSandbox— acceptsnapshotNamesnapshotIdbecomes optional (positional) and a newsnapshotNamefield is added toCreateSandboxOptions. Exactly one must be provided. To avoid confusion,snapshotIdis intentionally not duplicated on the options object.Validation throws a
LangSmithValidationErrorif neither (or both) is provided.listSnapshots— addListSnapshotsOptionsAll three options are optional and independent. Omitting them keeps today's zero-arg behavior — the request URL has no query string. The new type is re-exported from the sandbox public index.
Tests (
src/tests/sandbox.test.ts)All 80 sandbox tests pass locally.
README
Breaking changes
None. `createSandbox(snapshotId)` calls keep working unchanged; the positional arg is now optional, but the payload behavior is identical when it is provided.
Made with Cursor