โ† Back to Docs

๐Ÿ—๏ธ DCDN Sandbox

Decentralized agent sandboxes โ€” persistent, isolated environments for AI agents on the DCDN node network.

โœ… Generally Available 8 Regions x402 Compatible
๐Ÿ–ฅ๏ธ

Full Computer

Shell, filesystem, background processes. Not a restricted runtime โ€” a real Linux environment.

๐ŸŒ

Decentralized

Sandboxes run on 8+ independent nodes across 4 regions. No single point of failure.

๐Ÿ’ค

Auto-Sleep / Wake

Idle sandboxes sleep automatically. Wake instantly on next request. Pay only for active CPU.

๐Ÿ“ธ

Snapshots

Save and restore sandbox state. Fork sessions. Roll back to checkpoints.

๐Ÿ’ณ

x402 Payments

AI agents pay per-call with USDC. No API keys, no accounts, no subscriptions.

๐Ÿ’ฐ

80% Cheaper

Active CPU pricing. Node operator competition keeps prices low. From $0.005/hr.

Quick Start

JavaScript / TypeScript

npm install @dcdn/sandbox
import { DcdnSandbox } from '@dcdn/sandbox';

const client = new DcdnSandbox({ apiKey: 'dcdn_live_...' });

// Get or create a sandbox (idempotent)
const sbx = await client.getOrCreate('my-coding-agent', {
  image: 'dcdn/sandbox-python',
  size: 'basic',
});

// Run commands
const result = await sbx.exec('python -c "print(42)"');
console.log(result.stdout); // "42"

// File operations
await sbx.writeFile('/workspace/app.py', 'print("hello world")');
const content = await sbx.readFile('/workspace/app.py');

// Git clone
await sbx.gitClone('https://github.com/org/repo', { targetDir: '/workspace' });

// Background process + preview URL
const proc = await sbx.startProcess('npm run dev', { cwd: '/workspace' });
const { url } = await sbx.exposePort(3000);
console.log(`Preview: ${url}`);

// Snapshot and restore
const snap = await sbx.snapshot();
await sbx.restore(snap.snapshotId);

// Sleep / Wake
await sbx.sleep();   // pauses instantly
await sbx.wake();    // resumes instantly

// Clean up
await sbx.destroy();

Python

pip install dcdn-sandbox
from dcdn_sandbox import Sandbox

# Get or create (idempotent)
sbx = Sandbox(api_key="dcdn_live_...", name="my-agent")

# Execute commands
result = sbx.exec("echo hello && uname -a")
print(result.stdout)

# File operations
sbx.write_file("/workspace/data.csv", "a,b,c\n1,2,3")
content = sbx.read_file("/workspace/data.csv")

# Background processes
proc = sbx.start_process("python server.py")
print(f"PID: {proc.pid}, logs: {proc.log_file}")

# Snapshots
snap = sbx.snapshot()
sbx.restore(snap.snapshot_id)

# Lifecycle
sbx.sleep()
sbx.wake()
sbx.destroy()

cURL

# Create sandbox
curl -X POST https://dcdncloud.com/api/v1/sandbox \
  -H "Authorization: Bearer dcdn_live_..." \
  -H "Content-Type: application/json" \
  -d '{"name": "my-sandbox", "image": "ubuntu:22.04", "size": "basic"}'

# Execute command
curl -X POST https://dcdncloud.com/api/v1/sandbox/sbx-abc123/exec \
  -H "Authorization: Bearer dcdn_live_..." \
  -H "Content-Type: application/json" \
  -d '{"command": "echo hello world"}'

API Reference

MethodEndpointDescription
POST/sandboxCreate or get sandbox by name (idempotent)
GET/sandboxList all sandboxes
GET/sandbox/{id}Get sandbox details
DELETE/sandbox/{id}Destroy sandbox
POST/sandbox/{id}/execExecute command
PUT/sandbox/{id}/files/writeWrite file
GET/sandbox/{id}/files/readRead file
GET/sandbox/{id}/filesList directory
GET/sandbox/{id}/files/watchWatch filesystem (SSE)
POST/sandbox/{id}/git/cloneGit clone into sandbox
POST/sandbox/{id}/processStart background process
GET/sandbox/{id}/processesList processes
DELETE/sandbox/{id}/process/{pid}Kill process
GET/sandbox/{id}/process/{pid}/logsGet process logs
POST/sandbox/{id}/exposeExpose port (preview URL)
GET/sandbox/{id}/portsList exposed ports
POST/sandbox/{id}/snapshotTake snapshot
GET/sandbox/{id}/snapshotsList snapshots
POST/sandbox/{id}/restoreRestore from snapshot
POST/sandbox/{id}/sleepSleep (pause) sandbox
POST/sandbox/{id}/wakeWake (resume) sandbox
WS/sandbox/{id}/terminalWebSocket PTY terminal

Pricing

Active CPU pricing โ€” you only pay when your sandbox is actively computing. Sleeping sandboxes cost $0.

Lite

$0.005/hr
0.5 vCPU โ€ข 512 MB โ€ข 5 GB

Basic

$0.01/hr
1 vCPU โ€ข 1 GB โ€ข 10 GB

Standard

$0.02/hr
2 vCPU โ€ข 2 GB โ€ข 20 GB

Large

$0.04/hr
4 vCPU โ€ข 4 GB โ€ข 40 GB

Images

ImageContents
dcdn/sandbox-baseUbuntu 22.04, Python 3.11, Node 20, Git, curl
dcdn/sandbox-python+ pandas, numpy, matplotlib, jupyter
dcdn/sandbox-node+ npm, yarn, pnpm, TypeScript
dcdn/sandbox-fullAll of the above + Go, Rust
ubuntu:22.04Stock Ubuntu
python:3.12-slimMinimal Python
node:22-slimMinimal Node.js

Payment

Sandbox usage is billed from your Marketplace USD Balance, funded via Stripe. No crypto required.

Mesh Network Integration

Attach a sandbox to your DCDN Mesh to access private resources:

POST /api/v1/sandbox
{
  "name": "my-sandbox",
  "size": "basic",
  "mesh_network_id": "net-abc123"   // attach to mesh
}

The sandbox gets a WireGuard interface and can reach all peers + exposed routes. Apply mesh policies to control access.

vs Cloudflare Sandboxes

FeatureCloudflareDCDN
InfrastructureCentralized (CF edge)Decentralized (8+ nodes)
Vendor lock-inHigh (CF Workers ecosystem)None (standard Docker)
Agent paymentsAPI key onlyx402 (USDC, no account)
Custom imagesLimitedAny Docker image
Revenue model100% Cloudflare70% node operator / 25% platform
PricingCF Workers pricingFrom $0.005/hr (80% cheaper)

DCDN Cloud โ€” Decentralized CDN, DNS, WAF, GPU Cloud & AI Platform
dcdncloud.com ยท Marketplace ยท Mesh ยท Docs ยท Dashboard