v0.2.0 · Open Source · MIT

Unified Sandbox SDK
for AI Agents

One TypeScript interface. Five cloud providers.
Zero vendor lock-in.

Get Started
Scroll ↓

Quick Start

pnpm add @sandbank.dev/core @sandbank.dev/daytona
sandbox.ts
import { createProvider } from '@sandbank.dev/core'
import { DaytonaAdapter } from '@sandbank.dev/daytona'

const provider = createProvider(
  new DaytonaAdapter({ apiKey: process.env.DAYTONA_API_KEY })
)

const sandbox = await provider.create({ image: 'node:22' })
const result = await sandbox.exec('echo "Hello from the sandbox"')
console.log(result.stdout) // Hello from the sandbox

await provider.destroy(sandbox.id)

Adapters

Sandbank Cloud< 1 s
Managed KVMexec · port.expose · snapshot · browser
Daytona~10 s
Full VMport.expose · terminal · volumes
Fly.io~3-5 s
Firecracker microVMexec.stream · port.expose
Cloudflare~1 s
V8 isolate + containerexec.stream · snapshot · sleep · port.expose
BoxLite~2-5 s
Bare-metal KVMexec.stream · snapshot · sleep

Same interface. Swap with one line.

Provider Hot-Swap

swap.ts
// Switch from Daytona to Fly.io — zero code change
import { FlyioAdapter } from '@sandbank.dev/flyio'

const provider = createProvider(
  new FlyioAdapter({
    apiToken: process.env.FLY_API_TOKEN,
    appName: 'my-sandbox-pool',
  })
)

// Same API — create, exec, destroy
const sandbox = await provider.create({ image: 'python:3.12' })
await sandbox.exec('pip install numpy && python -c "import numpy; print(numpy.__version__)"')

Capability Detection

capabilities.ts
import { withStreaming, withPortExpose, withSnapshot } from '@sandbank.dev/core'

// Check capabilities at runtime
if (provider.capabilities.has('port.expose')) {
  const portSandbox = withPortExpose(sandbox)!
  const { url } = await portSandbox.exposePort(3000)
  console.log(`Preview: ${url}`)
}

// Safe narrowing — returns null if unsupported
const streamable = withStreaming(sandbox)
if (streamable) {
  const stream = await streamable.execStream('tail -f /var/log/app.log')
}

Service Layer

Compute + Data.
Not just sandboxes.

DB9ServiceProvider

Serverless PostgreSQL for AI agents via db9.ai. Credentials auto-injected into sandboxes. Shared databases enable multi-agent memory, task coordination, and semantic search.

PostgreSQL 17pgvectorpg_cronInstant branchingLISTEN/NOTIFY
service.ts
import { createProvider } from '@sandbank.dev/core'
import { DaytonaAdapter } from '@sandbank.dev/daytona'
import { Db9ServiceAdapter } from '@sandbank.dev/db9'

const compute = createProvider(new DaytonaAdapter({ apiKey: '...' }))
const db9 = new Db9ServiceAdapter({ token: process.env.DB9_TOKEN! })

// Create a database — credentials auto-injected into sandbox
const db = await db9.createService({ type: 'postgres', name: 'my-app' })

const sandbox = await compute.create({
  image: 'node:22',
  env: db.credentials.env,  // DATABASE_URL, PGHOST, PGPORT, ...
})

await sandbox.exec('psql $DATABASE_URL -c "SELECT version()"')

Service adapters implement ServiceProvider — a separate interface from compute adapters. Compute runs your code. Services provide the data layer.

Multi-Agent

Spawn. Communicate.
Orchestrate.

orchestrate.ts
import { createSession } from '@sandbank.dev/core'

const session = await createSession({
  provider,
  relay: { type: 'memory' },
})

const architect = await session.spawn('architect', { image: 'node:22' })
const developer = await session.spawn('developer', { image: 'node:22' })

// Shared context — visible to all sandboxes
await session.context.set('spec', {
  endpoints: ['/users', '/posts'],
  database: 'postgresql',
})

// Wait for all agents to complete
const results = await session.waitForAll()
console.log(results) // [{ name: 'architect', status: 'success' }, ...]
Real-time relayShared contextSkill injection

Inside the Sandbox

agent.ts
// Code running inside the sandbox
import { connect } from '@sandbank.dev/agent'

const session = await connect() // auto-reads env vars

session.on('message', async (msg) => {
  if (msg.type === 'task') {
    const result = await executeTask(msg.payload)
    await session.send(msg.from, 'task_result', result)
  }
})

// Signal completion
await session.complete({ status: 'success', summary: 'Built 3 endpoints' })

Packages

corepnpm add @sandbank.dev/core
cloudpnpm add @sandbank.dev/cloud
daytonapnpm add @sandbank.dev/daytona
flyiopnpm add @sandbank.dev/flyio
cloudflarepnpm add @sandbank.dev/cloudflare
boxlitepnpm add @sandbank.dev/boxlite

Service Layer

db9pnpm add @sandbank.dev/db9