Skip to content

Lifecycle and Persistence

Sprites are persistent, stateful environments that maintain their filesystem and state between runs. This page covers how Sprites manage their lifecycle, including hibernation, persistence, and resource allocation.

Sprites automatically hibernate when inactive to minimize costs. While hibernated:

  • No compute charges - You only pay for storage
  • Full state preserved - All files and data intact
  • Instant wake - Resume execution immediately on next request

By default, Sprites hibernate after 30 seconds of inactivity. This timeout is not configurable yet.

A Sprite is considered active when any of the following are true:

  1. A command is executing (via exec or console)
  2. Data is being written to stdin
  3. There’s an active TCP connection to the Sprite’s URL
  4. A detachable session is running

The inactivity timer resets each time activity is detected.

When you interact with a hibernated Sprite, it automatically wakes:

Terminal window
# Sprite is hibernated...
sprite exec echo "hello" # Sprite wakes, runs command, result returns
# Next command uses already-awake sprite
sprite exec echo "world" # Fast, no wake needed

Wake time is typically under a few seconds. Your data, installed packages, and filesystem state are all preserved.

Every Sprite has a persistent ext4 filesystem:

  • 100GB provisioned storage (current default)
  • Standard ext4 compatibility (SQLite, shared memory, all tools work)
  • TRIM-friendly billing (pay only for actual data)

Active Sprite

Running on compute

NVMe Storage
Files
SQLite
Git
Packages
Latency<1ms

Hibernated

Zero compute cost

Object Storage
Files
SQLite
Git
Packages
Redundancy3x geo
Running — fast NVMe access

Hover to pause

PersistedNot Persisted
All files and directoriesRunning processes
Installed packagesNetwork connections
Environment configurationsIn-memory state
Git repositoriesTemporary /tmp files
Databases (SQLite, etc.)Process PIDs
MetricValue
Provisioned size100 GB (current default)
BillingActual data written

Sprites currently run with a fixed configuration (8 vCPUs, 8192 MB RAM, 100 GB storage). These values are not configurable yet.

Sprites have internal lifecycle states such as:

StateDescription
pendingSprite is being created
activeSprite is running and ready
hibernatingSprite is transitioning to hibernation
hibernatedSprite is hibernated (no compute)
wakingSprite is waking from hibernation
errorSprite encountered an error

These states are not currently exposed in CLI/SDK responses.

For processes that need to run continuously and survive Sprite restarts, use Services instead of detachable sessions. Services are managed through the internal API and automatically restart when your Sprite boots.

FeatureServicesDetachable Sessions
Survives Sprite restartYesNo
Auto-starts on bootYesNo
Managed viaInternal API (curl-sprite-api)External CLI/SDK
DependenciesSupportedNot supported
Best forDaemons, dev serversOne-off tasks, builds

From inside your Sprite:

Terminal window
# Create a service that auto-starts on boot
curl-sprite-api -X PUT /v1/services/devserver -d '{
"cmd": "npm",
"args": ["run", "dev"]
}'
# List running services
curl-sprite-api /v1/services
# Stop a service
curl-sprite-api -X DELETE /v1/services/devserver

See Services for complete documentation.

  1. Clean up temporary files before long idle periods
  2. Use SQLite or file-based databases that persist naturally
  3. Plan for 30s idle hibernation (keep activity running if you need the sprite warm)
// For latency-sensitive operations, pre-warm the sprite
const sprite = await client.getSprite('my-sprite');
// This exec will wake the sprite if hibernated
await sprite.exec('true');
// Now the sprite is warm for subsequent operations
const result = await sprite.exec('your-actual-command');

For tasks that must run for extended periods:

  1. Use detachable sessions so commands survive disconnection
  2. Consider services if the process should auto-start on boot
  3. Consider checkpoints to save progress periodically
Terminal window
# Run in detachable session
sprite exec -detachable "python long_running_task.py"