Files
deepagentsjs/libs/standard-tests
dependabot[bot] 88986a2417 build(deps): bump the major-deps-updates-main group with 3 updates (#641)
Bumps the major-deps-updates-main group with 3 updates:
[@agentclientprotocol/sdk](https://github.com/agentclientprotocol/typescript-sdk),
[@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)
and [p-queue](https://github.com/sindresorhus/p-queue).

Updates `@agentclientprotocol/sdk` from 0.24.0 to 1.1.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/agentclientprotocol/typescript-sdk/releases">@​agentclientprotocol/sdk's
releases</a>.</em></p>
<blockquote>
<h2>v1.1.0</h2>
<h2><a
href="https://github.com/agentclientprotocol/typescript-sdk/compare/v1.0.0...v1.1.0">1.1.0</a>
(2026-06-29)</h2>
<h3>Features</h3>
<ul>
<li>Expose request ids in handler contexts (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/202">#202</a>)
(<a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/eda849ca7894f32e4ed11df81eb5b024e5512e5b">eda849c</a>)</li>
</ul>
<h2>v1.0.0</h2>
<h2><a
href="https://github.com/agentclientprotocol/typescript-sdk/compare/v0.29.0...v1.0.0">1.0.0</a>
(2026-06-24)</h2>
<h3>Features</h3>
<ul>
<li><strong>schema:</strong> Update to v1.16.0 of the schema (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/199">#199</a>)
(<a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/de5879100c1bb5e2fdaebc957c1ca01364eb33cc">de58791</a>)</li>
</ul>
<h3>Miscellaneous Chores</h3>
<ul>
<li>release 1.0.0 (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/201">#201</a>)
(<a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/008fc2861adc3f87edc4daa12eb78b81a6fd7161">008fc28</a>)</li>
</ul>
<h2>v0.29.0</h2>
<h2><a
href="https://github.com/agentclientprotocol/typescript-sdk/compare/v0.28.1...v0.29.0">0.29.0</a>
(2026-06-22)</h2>
<h3>Features</h3>
<ul>
<li><strong>unstable:</strong> Add support for request cancellation (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/195">#195</a>)
(<a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/d5197f9f6346a4b57084552e0bdf3c71ccf64412">d5197f9</a>)</li>
</ul>
<h2>v0.28.1</h2>
<h2><a
href="https://github.com/agentclientprotocol/typescript-sdk/compare/v0.28.0...v0.28.1">0.28.1</a>
(2026-06-19)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Expose peer contexts from app connections (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/190">#190</a>)
(<a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/d6573109fd7c27170cd970aa9b28e7e6054e993e">d657310</a>)</li>
</ul>
<h2>v0.28.0</h2>
<h2><a
href="https://github.com/agentclientprotocol/typescript-sdk/compare/v0.27.1...v0.28.0">0.28.0</a>
(2026-06-18)</h2>
<h3>Features</h3>
<ul>
<li><strong>schema:</strong> Update to schema v1.14.0 (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/185">#185</a>)
(<a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/3c619a737120bbd4ccc6282b893e94152125562c">3c619a7</a>)</li>
</ul>
<h2>v0.27.1</h2>
<h2><a
href="https://github.com/agentclientprotocol/typescript-sdk/compare/v0.27.0...v0.27.1">0.27.1</a>
(2026-06-18)</h2>
<h3>Bug Fixes</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/agentclientprotocol/typescript-sdk/blob/main/CHANGELOG.md">@​agentclientprotocol/sdk's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/agentclientprotocol/typescript-sdk/compare/v1.0.0...v1.1.0">1.1.0</a>
(2026-06-29)</h2>
<h3>Features</h3>
<ul>
<li>Expose request ids in handler contexts (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/202">#202</a>)
(<a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/eda849ca7894f32e4ed11df81eb5b024e5512e5b">eda849c</a>)</li>
</ul>
<h2><a
href="https://github.com/agentclientprotocol/typescript-sdk/compare/v0.29.0...v1.0.0">1.0.0</a>
(2026-06-24)</h2>
<h3>Features</h3>
<ul>
<li><strong>schema:</strong> Update to v1.16.0 of the schema (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/199">#199</a>)
(<a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/de5879100c1bb5e2fdaebc957c1ca01364eb33cc">de58791</a>)</li>
</ul>
<h3>Miscellaneous Chores</h3>
<ul>
<li>release 1.0.0 (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/201">#201</a>)
(<a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/008fc2861adc3f87edc4daa12eb78b81a6fd7161">008fc28</a>)</li>
</ul>
<h2><a
href="https://github.com/agentclientprotocol/typescript-sdk/compare/v0.28.1...v0.29.0">0.29.0</a>
(2026-06-22)</h2>
<h3>Features</h3>
<ul>
<li><strong>unstable:</strong> Add support for request cancellation (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/195">#195</a>)
(<a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/d5197f9f6346a4b57084552e0bdf3c71ccf64412">d5197f9</a>)</li>
</ul>
<h2><a
href="https://github.com/agentclientprotocol/typescript-sdk/compare/v0.28.0...v0.28.1">0.28.1</a>
(2026-06-19)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Expose peer contexts from app connections (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/190">#190</a>)
(<a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/d6573109fd7c27170cd970aa9b28e7e6054e993e">d657310</a>)</li>
</ul>
<h2><a
href="https://github.com/agentclientprotocol/typescript-sdk/compare/v0.27.1...v0.28.0">0.28.0</a>
(2026-06-18)</h2>
<h3>Features</h3>
<ul>
<li><strong>schema:</strong> Update to schema v1.14.0 (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/185">#185</a>)
(<a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/3c619a737120bbd4ccc6282b893e94152125562c">3c619a7</a>)</li>
</ul>
<h2><a
href="https://github.com/agentclientprotocol/typescript-sdk/compare/v0.27.0...v0.27.1">0.27.1</a>
(2026-06-18)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>node-adapter:</strong> Cap HTTP request body size (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/186">#186</a>)
(<a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/3832d4ce69d9f44c5f886c9b3ff24169d6119236">3832d4c</a>)</li>
<li><strong>node-adapter:</strong> harden Node adapter request parsing
(<a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/220eae660e459ac648fe352b756b586f39f9aa1e">220eae6</a>)</li>
</ul>
<h2><a
href="https://github.com/agentclientprotocol/typescript-sdk/compare/v0.26.0...v0.27.0">0.27.0</a>
(2026-06-18)</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/78023d41520d693fcc79aed9c9c635b7bc3e58e8"><code>78023d4</code></a>
chore(main): release 1.1.0 (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/203">#203</a>)</li>
<li><a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/eda849ca7894f32e4ed11df81eb5b024e5512e5b"><code>eda849c</code></a>
feat: Expose request ids in handler contexts (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/202">#202</a>)</li>
<li><a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/f8bf32c6be943e59969f31c65f338914fe25420e"><code>f8bf32c</code></a>
chore(main): release 1.0.0 (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/200">#200</a>)</li>
<li><a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/008fc2861adc3f87edc4daa12eb78b81a6fd7161"><code>008fc28</code></a>
chore: release 1.0.0 (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/201">#201</a>)</li>
<li><a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/de5879100c1bb5e2fdaebc957c1ca01364eb33cc"><code>de58791</code></a>
feat(schema): Update to v1.16.0 of the schema (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/199">#199</a>)</li>
<li><a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/bdc626790d26470324a68f26df9d3b6c152cec4c"><code>bdc6267</code></a>
chore(main): release 0.29.0 (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/196">#196</a>)</li>
<li><a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/675ecbab8fde8054b621dd7c1ead758230d0c653"><code>675ecba</code></a>
chore: Update Hey API OpenAPI TS to 0.99 (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/197">#197</a>)</li>
<li><a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/d5197f9f6346a4b57084552e0bdf3c71ccf64412"><code>d5197f9</code></a>
feat(unstable): Add support for request cancellation (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/195">#195</a>)</li>
<li><a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/06c932a22a5f8dc3cf691b20f4cc9d312d6e26a1"><code>06c932a</code></a>
chore(deps): bump actions/checkout from 6.0.3 to 7.0.0 (<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/192">#192</a>)</li>
<li><a
href="https://github.com/agentclientprotocol/typescript-sdk/commit/ffdbaac36004d9623a6ed8f37030650e5c8f409e"><code>ffdbaac</code></a>
chore(deps-dev): bump <code>@​types/node</code> from 25.9.3 to 26.0.0
(<a
href="https://redirect.github.com/agentclientprotocol/typescript-sdk/issues/193">#193</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/agentclientprotocol/typescript-sdk/compare/v0.24.0...v1.1.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `@types/node` from 25.9.3 to 26.1.0
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node">compare
view</a></li>
</ul>
</details>
<br />

Updates `p-queue` from 8.1.1 to 9.3.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/sindresorhus/p-queue/releases">p-queue's
releases</a>.</em></p>
<blockquote>
<h2>v9.3.0</h2>
<ul>
<li>Add <code>timeoutRemaining</code> to <code>runningTasks</code>
57d0a1a</li>
</ul>
<hr />
<p><a
href="https://github.com/sindresorhus/p-queue/compare/v9.2.0...v9.3.0">https://github.com/sindresorhus/p-queue/compare/v9.2.0...v9.3.0</a></p>
<h2>v9.2.0</h2>
<ul>
<li>Improve performance (<a
href="https://redirect.github.com/sindresorhus/p-queue/issues/244">#244</a>)
87077d0</li>
</ul>
<hr />
<p><a
href="https://github.com/sindresorhus/p-queue/compare/v9.1.2...v9.2.0">https://github.com/sindresorhus/p-queue/compare/v9.1.2...v9.2.0</a></p>
<h2>v9.1.2</h2>
<ul>
<li>Fix: Export <code>PriorityQueue</code> type (<a
href="https://redirect.github.com/sindresorhus/p-queue/issues/242">#242</a>)
a20e1f3</li>
</ul>
<hr />
<p><a
href="https://github.com/sindresorhus/p-queue/compare/v9.1.1...v9.1.2">https://github.com/sindresorhus/p-queue/compare/v9.1.1...v9.1.2</a></p>
<h2>v9.1.1</h2>
<ul>
<li>Fix <code>signal</code> option not rejecting when task is aborted
while queued a64b316
<ul>
<li>If you use a custom queue class, you will have to add a
<code>remove()</code> method. See the built-in class.</li>
</ul>
</li>
</ul>
<hr />
<p><a
href="https://github.com/sindresorhus/p-queue/compare/v9.1.0...v9.1.1">https://github.com/sindresorhus/p-queue/compare/v9.1.0...v9.1.1</a></p>
<h2>v9.1.0</h2>
<ul>
<li>Add <a
href="https://github.com/sindresorhus/p-queue?tab=readme-ov-file#strict"><code>strict</code></a>
option for sliding window rate limiting 03b8156</li>
</ul>
<hr />
<p><a
href="https://github.com/sindresorhus/p-queue/compare/v9.0.1...v9.1.0">https://github.com/sindresorhus/p-queue/compare/v9.0.1...v9.1.0</a></p>
<h2>v9.0.1</h2>
<ul>
<li>Fix: Remove abort listener when operation completes (<a
href="https://redirect.github.com/sindresorhus/p-queue/issues/235">#235</a>)
e9074f0</li>
</ul>
<hr />
<p><a
href="https://github.com/sindresorhus/p-queue/compare/v9.0.0...v9.0.1">https://github.com/sindresorhus/p-queue/compare/v9.0.0...v9.0.1</a></p>
<h2>v9.0.0</h2>
<h3>Breaking</h3>
<ul>
<li>Require Node.js 20  b2600d5</li>
<li>Remove <code>throwOnTimeout</code> option - timeouts now always
throw e48716f
<ul>
<li>It was a mistake to not throw on timeouts and the option made it
complicated to handle types.</li>
<li>If you really need the old behavior back:</li>
</ul>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/sindresorhus/p-queue/commit/cfa917af261fb6db9eb1281221ba21093eb49e3d"><code>cfa917a</code></a>
9.3.0</li>
<li><a
href="https://github.com/sindresorhus/p-queue/commit/b5a483f2b76f977f89e0968afcbd5e61643dff11"><code>b5a483f</code></a>
Fix docs</li>
<li><a
href="https://github.com/sindresorhus/p-queue/commit/57d0a1a3ef683c3491aff71e03a4e3dfb4ed95a2"><code>57d0a1a</code></a>
Add <code>timeoutRemaining</code> to <code>runningTasks</code></li>
<li><a
href="https://github.com/sindresorhus/p-queue/commit/fc4b7369d915ade31416d603fd35fd26c1885851"><code>fc4b736</code></a>
9.2.0</li>
<li><a
href="https://github.com/sindresorhus/p-queue/commit/ea65ce3659cb3e3be2fbe7049e69e280f04c8378"><code>ea65ce3</code></a>
Tweaks</li>
<li><a
href="https://github.com/sindresorhus/p-queue/commit/87077d0214c203f38d0f36c4efee8172e67bf1c4"><code>87077d0</code></a>
Improve performance (<a
href="https://redirect.github.com/sindresorhus/p-queue/issues/244">#244</a>)</li>
<li><a
href="https://github.com/sindresorhus/p-queue/commit/53848611d103e16f39e94cba8c70a36f0ec791a0"><code>5384861</code></a>
Fix CI</li>
<li><a
href="https://github.com/sindresorhus/p-queue/commit/55d306ba03479dcc531a8e06deab24d3f60feacd"><code>55d306b</code></a>
9.1.2</li>
<li><a
href="https://github.com/sindresorhus/p-queue/commit/a20e1f34b5c82e4e91e5d2e0c8b663e831dc16ab"><code>a20e1f3</code></a>
Export <code>PriorityQueue</code> type (<a
href="https://redirect.github.com/sindresorhus/p-queue/issues/242">#242</a>)</li>
<li><a
href="https://github.com/sindresorhus/p-queue/commit/9eec7efb433c33f66799d9dec41aa56d43f3435a"><code>9eec7ef</code></a>
9.1.1</li>
<li>Additional commits viewable in <a
href="https://github.com/sindresorhus/p-queue/compare/v8.1.1...v9.3.0">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-02 05:08:05 +00:00
..
2026-04-07 08:48:53 -07:00

@langchain/sandbox-standard-tests

Shared integration test suites for deepagents sandbox providers. Run a single function call and get comprehensive coverage of the SandboxBackendProtocol — lifecycle management, command execution, file I/O, search, and more.

The package is framework-agnostic — it works with any test runner that provides describe, it, expect, beforeAll, and afterAll. A first-class Vitest sub-export is included for convenience.

Installation

npm install @langchain/sandbox-standard-tests

Quick start

Import from @langchain/sandbox-standard-tests/vitest and the Vitest primitives are injected automatically:

import { sandboxStandardTests } from "@langchain/sandbox-standard-tests/vitest";
import { MySandbox } from "./sandbox.js";

sandboxStandardTests({
  name: "MySandbox",
  skip: !process.env.MY_SANDBOX_TOKEN,
  timeout: 120_000,
  createSandbox: (opts) => MySandbox.create({ ...opts }),
  closeSandbox: (sb) => sb.close(),
  resolvePath: (name) => `/tmp/${name}`,
});

With any test runner

Import from the root entry point and pass your runner's primitives via the runner config property:

import { sandboxStandardTests } from "@langchain/sandbox-standard-tests";
import { describe, it, expect, beforeAll, afterAll } from "bun:test";
import { MySandbox } from "./sandbox.js";

sandboxStandardTests({
  name: "MySandbox",
  runner: { describe, it, expect, beforeAll, afterAll },
  createSandbox: (opts) => MySandbox.create({ ...opts }),
  closeSandbox: (sb) => sb.close(),
  resolvePath: (name) => `/tmp/${name}`,
});

Run with your test runner of choice:

npx vitest run sandbox.int.test.ts

That single sandboxStandardTests() call registers 11 describe blocks covering every method on the sandbox protocol.

Configuration

sandboxStandardTests accepts a StandardTestsConfig<T> object:

Option Type Required Description
name string yes Display name shown in the test runner (e.g. "ModalSandbox").
runner TestRunner yes* Test-runner primitives (describe, it, expect, beforeAll, afterAll). *Optional when importing from /vitest.
createSandbox (opts?) => Promise<T> yes Factory that creates and returns a running sandbox. Receives an optional { initialFiles } map.
resolvePath (relativePath: string) => string yes Converts a relative filename (e.g. "test-file.txt") to the provider-specific absolute path (e.g. "/tmp/test-file.txt" or "/home/app/test-file.txt").
closeSandbox (sandbox: T) => Promise<void> no Teardown function. If omitted the "close" lifecycle test is skipped.
createUninitializedSandbox () => T no Factory for a sandbox that has not been started yet. Enables the two-step initialization test.
skip boolean no Skip the entire suite (useful when credentials are missing).
sequential boolean no Run tests sequentially instead of in parallel (useful to avoid provider concurrency limits).
timeout number no Per-test timeout in ms. Defaults to 120_000 (2 min).

TestRunner

The runner object must provide these five primitives from your test framework:

interface TestRunner {
  describe: SuiteFn;
  it: TestFn;
  expect: ExpectFn;
  beforeAll: HookFn;
  afterAll: HookFn;
}

The describe and it functions may optionally expose .skip, .skipIf(condition), and .sequential modifiers. When a modifier is not available the suite gracefully degrades (e.g. describe.sequential falls back to describe).

SandboxInstance

Your sandbox class must implement the SandboxInstance interface, which extends SandboxBackendProtocol from deepagents:

interface SandboxInstance extends SandboxBackendProtocol {
  readonly isRunning: boolean;
  uploadFiles(
    files: Array<[string, Uint8Array]>,
  ): MaybePromise<FileUploadResponse[]>;
  downloadFiles(paths: string[]): MaybePromise<FileDownloadResponse[]>;
  initialize?(): Promise<void>;
}

The key difference from the base protocol is that uploadFiles and downloadFiles are required (they are optional in SandboxBackendProtocol).

What gets tested

Suite What it covers
Lifecycle create, isRunning, close, two-step initialize
Command execution echo, exit codes, multiline output, stderr, env vars, non-existent commands
File operations uploadFiles, downloadFiles, round-trip integrity
write() New files, parent directory creation, overwrite, special characters, unicode, long content
read() Basic read, non-existent path, offset, limit, offset + limit, unicode, chunked reads
edit() Single/multi occurrence, replaceAll, not-found handling, special chars, multiline, unicode
lsInfo() Directory listing, empty dirs, hidden files, large directories, absolute paths
grepRaw() Pattern search, glob filters, case sensitivity, nested directories, unicode
globInfo() Wildcards, recursive patterns, extension filters, character classes, deeply nested
Initial files Basic seeding, nested paths, empty files
Integration End-to-end write → read → edit workflows, complex directory operations, error handling

Sandbox reuse strategy

To avoid spinning up too many sandbox instances (which can hit provider concurrency limits), the test suite uses a single shared sandbox for the majority of tests. Only two kinds of tests create temporary instances:

  • Lifecycle tests that verify close and two-step initialization
  • Initial files tests that require a fresh sandbox with pre-seeded content

These temporary sandboxes are torn down immediately, so the concurrent sandbox count never exceeds 2.

Retry helper

The package exports a withRetry utility for working around transient sandbox creation failures (e.g. provider concurrency limits):

import { withRetry } from "@langchain/sandbox-standard-tests/vitest";

const sandbox = await withRetry(
  () => MySandbox.create({ memoryMb: 512 }),
  5, // max attempts (default: 5)
  15_000, // delay between attempts in ms (default: 15 000)
);

Real-world examples

Remote provider (Modal)

import {
  sandboxStandardTests,
  withRetry,
} from "@langchain/sandbox-standard-tests/vitest";
import { ModalSandbox } from "./sandbox.js";

const hasCredentials = !!(
  process.env.MODAL_TOKEN_ID && process.env.MODAL_TOKEN_SECRET
);

sandboxStandardTests({
  name: "ModalSandbox",
  skip: !hasCredentials,
  timeout: 180_000,
  createSandbox: (opts) =>
    ModalSandbox.create({ imageName: "alpine:3.21", ...opts }),
  createUninitializedSandbox: () =>
    new ModalSandbox({ imageName: "alpine:3.21" }),
  closeSandbox: (sb) => sb.close(),
  resolvePath: (name) => `/tmp/${name}`,
});

Sequential execution (Deno Deploy)

import { sandboxStandardTests } from "@langchain/sandbox-standard-tests/vitest";
import { DenoSandbox } from "./sandbox.js";

sandboxStandardTests({
  name: "DenoSandbox",
  skip: !process.env.DENO_DEPLOY_TOKEN,
  sequential: true,
  timeout: 120_000,
  createSandbox: (opts) => DenoSandbox.create({ memoryMb: 768, ...opts }),
  createUninitializedSandbox: () => new DenoSandbox({ memoryMb: 768 }),
  closeSandbox: (sb) => sb.close(),
  resolvePath: (name) => `/home/app/${name}`,
});

Local provider (Node VFS)

import { sandboxStandardTests } from "@langchain/sandbox-standard-tests/vitest";
import { VfsSandbox } from "./sandbox.js";

sandboxStandardTests({
  name: "VfsSandbox",
  skip: process.platform === "win32",
  timeout: 30_000,
  createSandbox: (opts) => VfsSandbox.create(opts),
  closeSandbox: (sb) => sb.stop(),
  resolvePath: (name) => name,
});

Custom runner (Bun)

import { sandboxStandardTests } from "@langchain/sandbox-standard-tests";
import { describe, it, expect, beforeAll, afterAll } from "bun:test";
import { MySandbox } from "./sandbox.js";

sandboxStandardTests({
  name: "MySandbox",
  runner: { describe, it, expect, beforeAll, afterAll },
  createSandbox: (opts) => MySandbox.create(opts),
  closeSandbox: (sb) => sb.close(),
  resolvePath: (name) => `/tmp/${name}`,
});

Adding provider-specific tests

After calling sandboxStandardTests, you can add provider-specific tests in the same file using standard Vitest describe / it blocks:

sandboxStandardTests({
  /* ... */
});

describe("MySandbox Provider-Specific Tests", () => {
  it("should support custom image types", async () => {
    const sb = await MySandbox.create({ image: "python:3.12" });
    const result = await sb.execute("python --version");
    expect(result.exitCode).toBe(0);
    await sb.close();
  });
});

License

MIT