Skip to main content

Documentation Index

Fetch the complete documentation index at: https://smithers.sh/llms.txt

Use this file to discover all available pages before exploring further.

import { Sandbox } from "smithers-orchestrator";

type SandboxVolumeMount = { host: string; container: string; readonly?: boolean };
type SandboxWorkspaceSpec = {
  name: string;
  snapshotId?: string;
  idleTimeoutSecs?: number;
  persistence?: "ephemeral" | "sticky";
};

type SandboxProps = {
  id: string;
  output: ZodObject | DrizzleTable | string;
  workflow?: (...args: any[]) => any;
  input?: unknown;
  runtime?: "bubblewrap" | "docker" | "codeplane"; // default "bubblewrap"; docker auto-falls back
  allowNetwork?: boolean; // default false
  reviewDiffs?: boolean; // default true
  autoAcceptDiffs?: boolean; // default false
  image?: string;
  env?: Record<string, string>;
  ports?: Array<{ host: number; container: number }>;
  volumes?: SandboxVolumeMount[];
  memoryLimit?: string; // e.g. "512m", "2g"
  cpuLimit?: string; // e.g. "0.5", "2"
  command?: string; // override default `smithers up bundle.tsx`
  workspace?: SandboxWorkspaceSpec; // codeplane only
  skipIf?: boolean;
  timeoutMs?: number;
  heartbeatTimeoutMs?: number;
  retries?: number;
  retryPolicy?: RetryPolicy;
  continueOnFail?: boolean;
  cache?: CachePolicy;
  dependsOn?: string[];
  needs?: Record<string, string>;
  label?: string;
  meta?: Record<string, unknown>;
  children?: ReactNode;
};
<Workflow name="code-gen-sandbox">
  <Sandbox
    id="generate"
    workflow={generateCodeWorkflow}
    input={{ prompt: ctx.input.prompt, language: "typescript" }}
    output={outputs.result}
    runtime="docker"
    image="node:20-alpine"
    env={{ NODE_ENV: "production" }}
    memoryLimit="1g"
    cpuLimit="1"
    allowNetwork={false}
    reviewDiffs
    timeoutMs={300_000}
  />
</Workflow>

Notes

  • Bundle limits: 100 MB total, 5 MB manifest, 1,000 patches max; path traversal rejected.
  • Concurrency cap via SMITHERS_MAX_CONCURRENT_SANDBOXES (default 10).
  • cleanup always runs in finally; codeplane requires CODEPLANE_API_URL and CODEPLANE_API_KEY.