[PR #165] [MERGED] feat: add SandboxProvider abstraction #171

Closed
opened 2026-02-16 06:17:20 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagentsjs/pull/165
Author: @christian-bromann
Created: 2/1/2026
Status: Merged
Merged: 2/5/2026
Merged by: @christian-bromann

Base: mainHead: cb/sandbox-updates


📝 Commits (10+)

📊 Changes

8 files changed (+774 additions, -4 deletions)

View changed files

.changeset/real-swans-crash.md (+5 -0)
📝 libs/deepagents/src/backends/index.ts (+7 -0)
📝 libs/deepagents/src/backends/protocol.ts (+218 -0)
libs/deepagents/src/backends/sandbox-provider.test.ts (+330 -0)
📝 libs/deepagents/src/index.ts (+7 -0)
📝 libs/providers/node-vfs/src/index.ts (+7 -3)
📝 libs/providers/node-vfs/src/sandbox.ts (+185 -1)
📝 libs/providers/node-vfs/src/types.ts (+15 -0)

📄 Description

Ports the SandboxProvider protocol from Python PR #900 to TypeScript. This adds a standardized interface for sandbox lifecycle management (list, create, delete), separate from sandbox execution.

Summary

  • Add SandboxProvider<MetadataT> interface for third-party sandbox integrations
  • Add SandboxInfo and SandboxListResponse types for paginated sandbox listings
  • Implement VercelSandboxProvider in @langchain/vercel-sandbox
  • Implement VfsSandboxProvider in @langchain/vfs-sandbox
  • Add comprehensive unit tests for protocol compliance

Motivation

The existing Sandbox classes mix execution (run commands, file ops) with lifecycle management (create, list, delete). This separation allows:

  1. CLI tools to list/manage user's sandboxes across providers
  2. Centralized resource management for cleanup
  3. Consistent API across different sandbox backends

Usage

import { VercelSandboxProvider } from "@langchain/vercel-sandbox";

const provider = new VercelSandboxProvider({ runtime: "node24" });

// Create a new sandbox
const sandbox = await provider.getOrCreate();

// Execute commands using the sandbox
const result = await sandbox.execute("node --version");

// List sandboxes (if supported by provider)
const { items } = await provider.list();

// Delete when done (idempotent)
await provider.delete({ sandboxId: sandbox.id });

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/deepagentsjs/pull/165 **Author:** [@christian-bromann](https://github.com/christian-bromann) **Created:** 2/1/2026 **Status:** ✅ Merged **Merged:** 2/5/2026 **Merged by:** [@christian-bromann](https://github.com/christian-bromann) **Base:** `main` ← **Head:** `cb/sandbox-updates` --- ### 📝 Commits (10+) - [`729eb32`](https://github.com/langchain-ai/deepagentsjs/commit/729eb32380fe4d1d42e0b42ea5d1cd65ebff807f) feat: add support for Vercel sandbox - [`44eef79`](https://github.com/langchain-ai/deepagentsjs/commit/44eef7927d46fb7757540c72ab047498bfc81984) format - [`d8522c8`](https://github.com/langchain-ai/deepagentsjs/commit/d8522c8b2eff8dd7b8d7fe717ba45a064a82f3a2) switch to deno - [`64ed9a2`](https://github.com/langchain-ai/deepagentsjs/commit/64ed9a2d55395694fe7baf530772172a6721ca7d) cr - [`e645daa`](https://github.com/langchain-ai/deepagentsjs/commit/e645daaa884dd1d3f99c6ba5eda3210c36089474) format - [`cc5d6ea`](https://github.com/langchain-ai/deepagentsjs/commit/cc5d6ea25e3c3fe60b422c22d38873e2fdd0c7d7) feat: add support for Vercel sandbox - [`8ff15c5`](https://github.com/langchain-ai/deepagentsjs/commit/8ff15c5795e46fb84fe4db616aae3ec832237fb5) feat: add VFS sandbox - [`038d91e`](https://github.com/langchain-ai/deepagentsjs/commit/038d91e0af86463efa8a0b010e1ae656acef6045) format - [`283137b`](https://github.com/langchain-ai/deepagentsjs/commit/283137bf5af9ab2be11d08a6d8f32a69cd57a532) rm vercel - [`49af269`](https://github.com/langchain-ai/deepagentsjs/commit/49af2696d1d8cc951c7e2e47f5d1c26aa68ec1e3) rename ### 📊 Changes **8 files changed** (+774 additions, -4 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/real-swans-crash.md` (+5 -0) 📝 `libs/deepagents/src/backends/index.ts` (+7 -0) 📝 `libs/deepagents/src/backends/protocol.ts` (+218 -0) ➕ `libs/deepagents/src/backends/sandbox-provider.test.ts` (+330 -0) 📝 `libs/deepagents/src/index.ts` (+7 -0) 📝 `libs/providers/node-vfs/src/index.ts` (+7 -3) 📝 `libs/providers/node-vfs/src/sandbox.ts` (+185 -1) 📝 `libs/providers/node-vfs/src/types.ts` (+15 -0) </details> ### 📄 Description Ports the `SandboxProvider` protocol from Python PR #900 to TypeScript. This adds a standardized interface for sandbox lifecycle management (list, create, delete), separate from sandbox execution. ### Summary - Add `SandboxProvider<MetadataT>` interface for third-party sandbox integrations - Add `SandboxInfo` and `SandboxListResponse` types for paginated sandbox listings - Implement `VercelSandboxProvider` in `@langchain/vercel-sandbox` - Implement `VfsSandboxProvider` in `@langchain/vfs-sandbox` - Add comprehensive unit tests for protocol compliance ### Motivation The existing `Sandbox` classes mix execution (run commands, file ops) with lifecycle management (create, list, delete). This separation allows: 1. **CLI tools** to list/manage user's sandboxes across providers 2. **Centralized resource management** for cleanup 3. **Consistent API** across different sandbox backends ### Usage ```typescript import { VercelSandboxProvider } from "@langchain/vercel-sandbox"; const provider = new VercelSandboxProvider({ runtime: "node24" }); // Create a new sandbox const sandbox = await provider.getOrCreate(); // Execute commands using the sandbox const result = await sandbox.execute("node --version"); // List sandboxes (if supported by provider) const { items } = await provider.list(); // Delete when done (idempotent) await provider.delete({ sandboxId: sandbox.id }); ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 06:17:20 -05:00
yindo closed this issue 2026-02-16 06:17:20 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#171