Sprites - Stateful sandboxes

3 min read Original article ↗

Stateful sandbox environments with checkpoint & restore

A Sprite is a hardware-isolated execution environment for arbitrary code: a persistent Linux computer. Whether it's an AI agent like Claude Code or a binary your user just uploaded, Sprites are the simplest answer for "where should I run a blob of code".

#

Install the Sprites CLI
curl https://sprites.dev/install.sh | bash

#

Create a new sprite
sprite create my-sprite

#

Run a Command
sprite exec -s my-sprite ls -la

#

Connect to the sprite console
sprite console -s my-sprite

# Create a new sprite
curl -X PUT https://api.sprites.dev/v1/sprites/my-sprite \
-H "Authorization: Bearer $SPRITES_TOKEN"

# Execute a command
curl -X POST https://api.sprites.dev/v1/sprites/my-sprite/exec \
-H "Authorization: Bearer $SPRITES_TOKEN" \
-d '{"command": "echo hello"}'
import { SpritesClient } from '@fly/sprites';

const client = new SpritesClient(process.env.SPRITES_TOKEN!);

// Get a Sprite reference
const sprite = client.sprite('my-sprite');

// Run a command!
const { stdout } = await sprite.exec('echo hello');
console.log(stdout);
client := sprites.New("your-auth-token")

// Get a sprite handle
sprite := client.Sprite("my-sprite")

// Run a command - just like exec.Command!
cmd := sprite.Command("echo", "hello", "world")
output, err := cmd.Output()
if err != nil {
log.Fatal(err)
}

fmt.Printf("Output: %s", output)

Stateful environment

Sprites are fully mutable and persistent between runs. Your data lives on a boring, ext4 filesystem. It's available when your Sprite runs.

Persistence

Unlimited checkpoints

Write files, install packages, build sqlite databases. Change whatever you need. When you're happy, checkpoint. When you're not, restore.

Checkpoints

Granular billing

Sprites come up fast, have a bunch of CPU and RAM available, and run as long as they need to. You pay only for the resources you use.

Billing

HTTP Access

Each Sprite has a unique URL. Share what you're building in public, hook up webhooks, serve APIs. If it's HTTP you can do it.

Sprite URLs

Billing

Sprites dynamically manage resources; we only bill for actual CPU cycles, resident memory, and consumed storage.

CPU Time

Measured from Linux cgroup CPU usage counters (cpu.stat usage_usec), tracking the total amount of CPU time consumed by your environment. Billed with a minimum of 6.25% CPU utilization per second of runtime.

Cumulative CPU usage measured by cpu.stat

$0.07 /CPU-hour

Memory Time

Measured by sampling Linux cgroup memory usage (memory.current) and accumulating the total over time. For example, using 2 GB of memory for 10 seconds equals 20 GB-seconds. Billed with a minimum of 0.25 GB (250 MB) per second of runtime.

Actual memory usage

$0.04375 /GB-hour

Storage Time

Hot Storage: Local NVMe cache used by the filesystem for active working data, sampled every few seconds. For example, 2 GB of cache for a 4-hour session equals 8 GB-hours.

Storage: Measured hourly by summing the actual size of all objects in your environment's storage bucket. For example, using 10 GB of storage for 24 hours equals 240 GB-hours.

Storage usage in GB-hours

Hot Storage

$0.000683 /GB-hour

Storage

$0.000027 /GB-hour

Examples

Claude Code Session

4-hour coding session with bursts to 100% of 8 CPUs and 8 GB RAM, averaging 30% of 2 CPUs and 1.5 GB

CPU (2.4 CPU-hrs) $0.17

Memory (6 GB-hrs) $0.26

Hot storage (5 GB × 4 hrs) $0.01

Storage (10 GB × 4 hrs) $0.00

Total ~$0.44

Web App

30 hours of wake time per month (~5 concurrent users avg), averaging 10% of 2 CPUs and 1 GB RAM

CPU (6 CPU-hrs) $0.42

Memory (30 GB-hrs) $1.31

Hot storage (3 GB × 30 hrs) $0.06

Storage (5 GB × 732 hrs) $0.10

Total ~$1.89/month

All resources are billed hourly based on actual usage.