Always-On Compute
Turn off auto-sleep so a Sprite keeps running until you explicitly stop it.
On this page
What it is
Normally a Sprite sleeps when idle. For continuous workloads (a queue consumer, a long-running agent, a bot holding a connection open) you can turn that off. An always-on Sprite keeps running until you stop it.
Why it matters: continuous workloads stay up, and you decide when compute shuts down.
An always-on Sprite is running, and billed as running, the whole time. Use it when you genuinely need continuous compute.
Choosing the right option
| You need… | Use |
|---|---|
| Never sleep | auto_idle: false (this page) |
| Sleep, but after longer than 30s | A longer idle_timeout_ms (up to 24h) |
| Stay up for the next hour or so | A keep-awake lease |
| Run at certain times | Cron Automations |
| A permanent production web app | Deploy to Fly.io |
Step by step: create an always-on Sprite
1. Create it with auto-idle off
ssh my-org@sprites.dev sprite create agent --no-auto-idle
# HTTP API
curl -sS -X POST "https://api.sprites.dev/v1/sprites" \
-H "Authorization: Bearer $SPRITES_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"agent","config":{"auto_idle":false}}'
2. Start your workload as a service
Register it as a service so it’s supervised and restarted if it crashes:
# Inside the Sprite
sprite-env service register consumer --restart always \
-- /bin/sh -lc 'cd /home/sprite/app && ./consume'
3. Confirm the policy
ssh my-org@sprites.dev sprite keep-awake agent
# HTTP API
curl -sS "https://api.sprites.dev/v1/sprites/agent/keep-awake" \
-H "Authorization: Bearer $SPRITES_TOKEN"
The response includes auto_idle and idle_timeout_ms.
4. Stop it when you’re done
ssh my-org@sprites.dev sprite stop agent
# HTTP API
curl -sS -X POST "https://api.sprites.dev/v1/sprites/agent/stop" \
-H "Authorization: Bearer $SPRITES_TOKEN"
Turning an existing Sprite always-on
ssh my-org@sprites.dev sprite update api --no-auto-idle
# 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":{"auto_idle":false}}'
Idle settings take effect at the next cold start. A Sprite that’s currently running or warm keeps its old policy until then. To apply it now, cold-stop and start it:
ssh my-org@sprites.dev sprite stop api --cold
ssh my-org@sprites.dev sprite start api
To turn auto-sleep back on:
ssh my-org@sprites.dev sprite update api --auto-idle
Middle ground: a longer idle timeout
If you just want a Sprite to linger longer between bursts of activity, raise its idle timeout instead (10 seconds to 24 hours):
ssh my-org@sprites.dev sprite update api --idle-timeout-ms 3600000 # 1 hour
Temporary alternative: keep-awake leases
A lease holds a Sprite awake for up to an hour and wakes it if it’s stopped. Renew it to keep going:
ssh my-org@sprites.dev sprite keep-awake api --for 1h
Inside the Sprite:
sprite-env keep-awake --for 15m
See Fast Creation and Wake-Up for details.
For production web apps
A Sprite is a development environment, and its URL serves whatever is running in it at the moment. For a web app that must be permanently up, restarted on failure, on its own APP.fly.dev address, deploy it as a Fly.io app. You can do this from inside the Sprite:
# Inside the Sprite, in your app's directory
fly auth login
fly launch --no-deploy --name my-app
fly deploy
The deployed app runs independently of the Sprite.