Skip to content
SegmentStream/ Docs

Loading documentation…

↑ ↓ to navigate  ↵ to open  Esc to close
Website Console
Section menu
SDKsAgent SDKTypeScript

@segmentstream/agent/sandbox

9 public exports from @segmentstream/agent/sandbox.

Public exports

SANDBOX_PREPARE_SCRIPT

The file toolset, installed once into the environment's snapshot while the network is still open. The Ubuntu packages exist in Ubuntu 26.04, the eve base image's release; a missing name would fail preparation and so the deploy. pdfplumber, which Ubuntu does not ship, is pinned with the two dependencies Ubuntu's are too old for, by version and hash, into the sandbox user's own site-packages. Install pip explicitly: Eve 0.84+ no longer includes it in the base image. Its pdfminer.six 20260107 is Ubuntu's python3-pdfminer. Browser Harness, which the agent's browser tool runs (`lib/browser.ts`), has an environment of its own at /opt/segmentstream/browser: it pins a newer Pillow than pdfplumber's. It is pinned with the dependencies it imports, by version and hash; httpx, which cdp-use declares but its client never imports, and fetch-use, which it imports only with a Browser Use key, are left out.

const SANDBOX_PREPARE_SCRIPT = "set -euo pipefail\nsudo apt-get update -q\nsudo env DEBIAN_FRONTEND=noninteractive apt-get install -y -q --no-install-recommends \\\n  poppler-utils qpdf tesseract-ocr tesseract-ocr-eng tesseract-ocr-rus 7zip unar \\\n  imagemagick ghostscript python3-pip python3-venv python3-pandas python3-openpyxl python3-pypdf \\\n  python3-pdfminer\nsudo apt-get clean\nsudo rm -rf /var/lib/apt/lists/*\nrequirements=\"$(mktemp)\"\ncat > \"$requirements\" <<'REQUIREMENTS'\npdfplumber==0.11.10 \\\n  --hash=sha256:7741ea81bf165b474b153e6789d10d18e06b6ddcf3ec84289c3ef2fed6802580\npillow==12.2.0 \\\n  --hash=sha256:4bfd07bc812fbd20395212969e41931001fd59eb55a60658b0e5710872e95286 \\\n  --hash=sha256:7b14cc0106cd9aecda615dd6903840a058b4700fcb817687d0ee4fc8b6e389be \\\n  --hash=sha256:8cbeb542b2ebc6fcdacabf8aca8c1a97c9b3ad3927d46b8723f9d4f033288a0f \\\n  --hash=sha256:22db17c68434de69d8ecfc2fe821569195c0c373b25cccb9cbdacf2c6e53c601\npypdfium2==5.9.0 \\\n  --hash=sha256:7ce3a3dd23ec0adaa079d8be54565ba2aa2f6060e76a4989cd42dabc163d74ee \\\n  --hash=sha256:1d902e03dff5efd51d93cd23d3e55bde53802fa6207bcd0e455239518859a069\nREQUIREMENTS\npython3 -m pip install --user --break-system-packages --no-cache-dir --no-deps \\\n  --only-binary=:all: --require-hashes --disable-pip-version-check -r \"$requirements\"\nrm -f \"$requirements\"\nsudo python3 -m venv /opt/segmentstream/browser\nbrowser_requirements=\"$(mktemp)\"\ncat > \"$browser_requirements\" <<'BROWSER_REQUIREMENTS'\nbrowser-harness==0.1.13 \\\n  --hash=sha256:2491459e4bfc0ee8aea22dc6c4680fc0f791b7ba553446323c50d2883449d769\ncdp-use==1.4.5 \\\n  --hash=sha256:8f8e2435e3a20e4009d2974144192cf3c132f6c2971338e156198814d9b91ecb\nwebsockets==15.0.1 \\\n  --hash=sha256:f7a866fbc1e97b5c617ee4116daaa09b722101d4a3c170c787450ba409f9736f\ntyping-extensions==4.15.0 \\\n  --hash=sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548\npillow==12.3.0 \\\n  --hash=sha256:e9aeb04d6aef139de265b29683e119b638208f88cf73cdd1658aa07221165321 \\\n  --hash=sha256:251bf95b67017e27b13d82f5b326234ca62d70f9cf4c2b9032de2358a3b12c7b\nBROWSER_REQUIREMENTS\nsudo /opt/segmentstream/browser/bin/python -m pip install --no-cache-dir --no-deps \\\n  --only-binary=:all: --require-hashes --disable-pip-version-check -r \"$browser_requirements\"\nrm -f \"$browser_requirements\"\nBH_HOME=\"$(mktemp -d)\" /opt/segmentstream/browser/bin/python -I -c \\\n  'import browser_harness.admin, browser_harness.helpers, cdp_use.client, PIL.Image'\nmkdir -p /workspace/work\nfor tool in pdftotext pdftoppm qpdf tesseract gs 7z unar unzip jq rg; do\n  command -v \"$tool\" > /dev/null\ndone\nlanguages=\"$(tesseract --list-langs)\"\ngrep -qx eng <<< \"$languages\"\ngrep -qx rus <<< \"$languages\"\npython3 -c 'import openpyxl, pandas, pdfminer, pdfplumber, pypdf, pypdfium2'\n"
SANDBOX_TOOLSET_VERSION
const SANDBOX_TOOLSET_VERSION: string
SANDBOX_VCPUS

Each live sandbox's compute; Vercel pairs every vCPU with 2 GB of memory.

const SANDBOX_VCPUS = 2
default

Opens the session's sandbox without network access and marks it as the SDK's.

const _default: import("eve/sandbox").SandboxSelector
environment

The environment `eve build` prepares. It carries no network policy: one applied here would hold during preparation too, before the toolset is installed.

const environment: import("eve/sandbox").SandboxEnvironment<import("eve/sandbox/vercel").VercelSandboxRuntimeOptions, import("eve/sandbox/vercel").VercelSandboxSession>
openSandbox

Opens a session's sandbox from a prepared environment without network access and marks it.

function openSandbox(prepared: ReturnType<typeof VercelSandbox.environment>, input: {
    readonly sessionId: string;
    readonly toolset: string;
}): Promise<import("eve/sandbox").RuntimeSandboxSession<import("eve/sandbox/vercel").VercelSandboxSession>>;
prepareSandbox
function prepareSandbox(sandbox: SandboxSession): Promise<void>;
runPreparation

Runs a toolset's preparation script; a failure fails preparation and so the build.

function runPreparation(sandbox: SandboxSession, script: string): Promise<void>;
toolsetVersion

Identifies a toolset. eve keys a prepared snapshot on the authored `sandbox.ts` and the environment's options, not on a `prepare` imported from a package, so the version travels as a sandbox tag: a changed toolset is a new snapshot.

function toolsetVersion(script: string): string;