Fast Creation and Wake-Up
Create Sprites in seconds, let them sleep between jobs, and have them wake the instant work arrives.
On this page
What it is
Sprites are built to start fast. In benchmarks, the P99 time from creating a Sprite to doing useful work is 5 seconds or less. The same holds for starting an existing Sprite, even one that has been dormant for a couple of months. Because of that, you don’t need to keep machines running “just in case.” Let a Sprite go to sleep between workloads, and when a request, command, or scheduled job arrives, it wakes up and gets to work.
Why it matters: compute is ready quickly when work arrives. You can sleep Sprites between workloads without facing long startup delays when you need them again, and you pay for compute only while work is happening.
How a Sprite sleeps and wakes
A Sprite is always in one of these states:
| HTTP status | SSH status | What it means | Time to wake |
|---|---|---|---|
running | running | Running and billed as running. | n/a |
warm | warm_stopped | Stopped, but its runtime is kept on the host. | About a second |
cold | stopped | Stopped; only the filesystem is kept. Also a Sprite that has never started. | A few seconds |
error | error | Something went wrong; see last_error on the Sprite. | n/a |
deleting | deleting | Being deleted. | n/a |
The lifecycle goes like this:
- Running. The Sprite is doing work.
- Idle. Nothing has kept it awake for its idle timeout (30 seconds by default).
- Warm. The host stops it but keeps its runtime ready.
- Cold. If the host later needs the capacity, the warm Sprite goes cold. Its disk is still fully preserved.
- Wake. The next request, exec, or automation starts it again, from warm or cold.
What keeps a Sprite awake
The idle timer counts from the last of these:
- An exec or shell session that’s still running (even if the client disconnected and could reconnect).
- An open HTTP request, WebSocket, or TCP connection to its URL or one of its services.
- A keep-awake lease (see below).
Running services, background processes, and log streams do not keep a Sprite awake. A web server sitting idle with no open connections will be put to sleep, and it’s started again automatically on the next request.
What wakes a Sprite
- A request to its URL or to one of its services.
sprite exec, a shell, or a file write.- An automation firing.
sprite start, or a keep-awake lease.
Step by step: create, sleep, and wake
1. Create a Sprite
ssh my-org@sprites.dev sprite create api
# HTTP API
curl -sS -X POST "https://api.sprites.dev/v1/sprites" \
-H "Authorization: Bearer $SPRITES_TOKEN" \
-H "Content-Type: application/json" -d '{"name":"api"}'
The call returns once the Sprite is running. You can choose its resources at creation:
ssh my-org@sprites.dev sprite create worker ubuntu:24.04 --max-cpus 2 --max-ram-gb 4
# HTTP API
curl -sS -X POST "https://api.sprites.dev/v1/sprites" \
-H "Authorization: Bearer $SPRITES_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"worker","config":{"image_url":"ubuntu:24.04","max_cpus":2,"max_ram_gb":4}}'
The first time you use a new image, pulling it can take minutes. To keep creation fast, prepare a template and fork it.
2. (Optional) Create it without starting
If you want a Sprite ready to go but not running yet:
ssh my-org@sprites.dev sprite create prepared --no-start
# HTTP API
curl -sS -X POST "https://api.sprites.dev/v1/sprites" \
-H "Authorization: Bearer $SPRITES_TOKEN" \
-H "Content-Type: application/json" -d '{"name":"prepared","start":false}'
3. Let it go to sleep
Do nothing. After 30 seconds without activity it warm-stops. Check with:
ssh my-org@sprites.dev sprite get api
Look for "status":"warm_stopped" (or "warm" if you use GET /sprites/api).
4. Wake it by using it
Just send it work. No explicit start is needed:
ssh my-org@sprites.dev sprite exec api 'echo awake'
Requests to its URL, file writes, and automations wake it the same way.
Tuning the idle timeout
Change how long a Sprite waits before sleeping with idle_timeout_ms (from 10000, 10 seconds, to 86400000, 24 hours):
ssh my-org@sprites.dev sprite update api --idle-timeout-ms 300000
# HTTP API
curl -sS -X PUT "https://api.sprites.dev/v1/sprites/api" \
-H "Authorization: Bearer $SPRITES_TOKEN" \
-H "Content-Type: application/json" \
-d '{"config":{"idle_timeout_ms":300000}}'
Idle settings take effect at the next cold start. A Sprite that is currently running or warm keeps its old policy until then.
Stopping on purpose
You can stop a Sprite yourself, which is useful when you know a job has finished.
# Warm stop: fast, keeps the runtime so the next start is quick.
ssh my-org@sprites.dev sprite stop api
# Cold stop: releases the runtime but keeps the filesystem.
ssh my-org@sprites.dev sprite stop api --cold
# Stop now, start again automatically in 60 seconds.
ssh my-org@sprites.dev sprite stop api --wake-after 60000
# Start explicitly.
ssh my-org@sprites.dev sprite start api
# HTTP API: warm stop
curl -sS -X POST "https://api.sprites.dev/v1/sprites/api/stop" \
-H "Authorization: Bearer $SPRITES_TOKEN"
# Cold stop
curl -sS -X POST "https://api.sprites.dev/v1/sprites/api/stop" \
-H "Authorization: Bearer $SPRITES_TOKEN" \
-H "Content-Type: application/json" -d '{"cold":true}'
# Stop now, start again in 60 seconds
curl -sS -X POST "https://api.sprites.dev/v1/sprites/api/stop" \
-H "Authorization: Bearer $SPRITES_TOKEN" \
-H "Content-Type: application/json" -d '{"wake_after_ms":60000}'
# Start explicitly
curl -sS -X POST "https://api.sprites.dev/v1/sprites/api/start" \
-H "Authorization: Bearer $SPRITES_TOKEN"
A stop streams the current sprite record, then sprite_status, then sprite_stopped (whose status is warm_stopped or stopped, with mode warm or cold). A start streams one or more sprite_status events, then sprite_resumed (from warm) or vm (from cold).
When a Sprite stops, each service gets its stop signal (SIGTERM by default) and up to 10 seconds (configurable to 20) to exit cleanly. Other processes get SIGTERM and are killed once the services are done.
Holding a Sprite awake temporarily
If you need a Sprite to stay up for a while without a connection open, take out a keep-awake lease. It holds the Sprite awake, and wakes it if it’s stopped, for up to one hour:
ssh my-org@sprites.dev sprite keep-awake api --for 1h # take a lease
ssh my-org@sprites.dev sprite keep-awake api # check it
ssh my-org@sprites.dev sprite keep-awake api --release # end it early
# HTTP API
curl -sS -X POST "https://api.sprites.dev/v1/sprites/api/keep-awake" \
-H "Authorization: Bearer $SPRITES_TOKEN" \
-H "Content-Type: application/json" -d '{"duration_ms":3600000}'
curl -sS "https://api.sprites.dev/v1/sprites/api/keep-awake" \
-H "Authorization: Bearer $SPRITES_TOKEN"
curl -sS -X DELETE "https://api.sprites.dev/v1/sprites/api/keep-awake" \
-H "Authorization: Bearer $SPRITES_TOKEN"
From inside the Sprite, it can hold itself awake:
sprite-env keep-awake --for 15m
Each lease replaces the previous one, so renew it before it ends if you need longer. When it ends, the normal idle timeout starts counting. An explicit stop also ends the lease.
For a Sprite that should never sleep, see Always-On Compute.
Services and wake-up
Registered services start again on every wake. If a request arrives while a service is still starting, it waits for the service to listen on its port, for up to 60 seconds. If the service never comes up, HTTP callers get 503 service_start_timeout with a Retry-After header. Check readiness with:
sprite-env service status http # look for runtime.ready: true
Good to know
- Waking from warm takes about a second; from cold, a few seconds. P99 from create or start to useful work is 5 seconds or less in benchmarks.
- A Sprite’s filesystem is preserved across warm stops, cold stops, and host moves (unless it uses an ephemeral disk).
- CPU and memory changes made with
sprite updatetake effect at the next cold start.