Pluggable Code Execution Sandboxes

Runs scripts and plugin code through a vendor-neutral sandbox contract with explicit capabilities, limits, and typed outcomes.

Overview

Description

Pluggable Code Execution Sandboxes provide one vendor-neutral contract for running untrusted scripts, SDK plugins, and marketplace assets. A request carries code, language, inputs, purpose, resource limits, an idempotency key, and an explicit capability grant. An executor advertises the languages and security controls it can truly enforce, then returns a typed result covering success, execution errors, timeouts, denied capabilities, unsupported languages, unenforceable limits, or a deliberately disabled runtime.

The seam keeps tenant identity and credentials out of the sandbox request. Those facts remain in the host enforcement layer, which may supply a pre-authorized host context separately. Built-in types cover shell, PowerShell, JavaScript, TypeScript, Python, and Ruby, while concrete providers live in isolated server-only subpaths. A disabled null executor makes “code execution off” an explicit, auditable outcome rather than a missing dependency or accidental local execution.

Selling Points

  • Product features can request code execution without binding themselves to Docker, a cloud sandbox vendor, or a specific host.
  • Capability envelopes make providers state what they enforce before a run is dispatched.
  • Typed terminal outcomes let callers distinguish user code failure from policy denial, unsupported language, timeout, and disabled service.
  • Tenant and auth data never enter the untrusted request shape, reducing the chance of credential leakage into code.
  • A formal provider contract lets deployments choose or add sandbox implementations while preserving one consumer API.

User Story

An external developer builds an SDK plugin that needs to run TypeScript for sixty seconds with no network access. The plugin host derives the capability grant and submits a standard execution request. The selected sandbox validates that it can enforce the requested language, limits, and network policy, runs the code, and returns a provider-neutral result. The developer's feature works unchanged if the deployment later switches from a hosted provider to another conforming executor.

Extension Surface

This feature is pluggable. packages/code-execution/src/contracts/code-executor.ts defines the formal CodeExecutorLike registration axis, including declared capabilities and optional streaming. Providers implement the contract in their own node-only subpaths and are injected at composition. Consumers do not change core code to select a conforming implementation.

Capabilities & Limits

  • It models seven languages, three execution purposes, resource limits, idempotency, and typed results.
  • It advertises network, Dots API, secret, filesystem, and streaming capabilities before dispatch.
  • It includes a safe disabled executor and deny-all grant seed.
  • Limit: the seam does not itself create a sandbox or grant authority; a concrete provider and host enforcement layer are required.

Implementation Map

  • packages/code-execution/src/contracts/code-executor.ts
  • packages/code-execution/src/index.ts
  • packages/code-execution/src/capabilities.ts
  • packages/code-execution/src/grants.ts
  • packages/code-execution/src/disabled-executor.ts

Properties

Property
Value
product
dots-platform
extensibility
pluggable
module
Code Execution, SDK
packages
code-execution
status
shipped
surface
api
summary
Runs scripts and plugin code through a vendor-neutral sandbox contract with explicit capabilities, limits, and typed outcomes.

Connections

Pluggable Code Execution Sandboxes · Explore connections

  • implemented bytopackages/code-execution/src/grants.ts
  • implemented bytopackages/code-execution/src/contracts/code-executor.ts
  • implemented bytopackages/code-execution/src/index.ts
  • implemented bytopackages/code-execution/src/disabled-executor.ts
  • implemented bytopackages/code-execution/src/capabilities.ts
  • complementstoLocal Docker Code Sandbox
  • complementstoHosted E2B Code Sandbox
  • extendsfromHosted E2B Code Sandbox
  • extendsfromLocal Docker Code Sandbox
  • extendsfromAudited Code Execution Runs
  • extendsfromGrant-Scoped Dots API Access for Sandboxes

Connected Records11

Complements
Extends
Implemented by
packages/code-execution/src/capabilities.ts
packages/code-execution/src/contracts/code-executor.ts
packages/code-execution/src/disabled-executor.ts
packages/code-execution/src/grants.ts
packages/code-execution/src/index.ts
11 connections.