Install
Create a sailbox
Create a Sail app namespace, then start a sailbox from the Debian arm64 image:Sailbox.create() returns after the VM is running. Pass cpu, memory_mib,
and disk_gib to size the sailbox, and ingress_ports to expose services.
Sailboxes should use
sail.Image.debian_arm64 or sail.Image.debian_arm. We
have plans to support AMD64 images soon - please contact us if you would like
us to prioritise this.Sailbox.connect():
connect() returns a full Sailbox handle that can run commands, read and
write files, manage listeners, and make network requests. It verifies the
current placement for a running sailbox and resumes a paused or sleeping
sailbox before returning.
Run commands
exec() starts a shell command and returns a durable exec request. Call wait()
to read stdout, stderr, and the return code.
cwd to run from a working directory. Use background=True for long-lived
processes such as web servers.
Read and write files
Usewrite() to upload bytes, strings, or file-like objects into the sailbox
filesystem and read() to fetch regular files back as bytes. Paths must be
absolute. Missing parent directories are created by default. Pass mode to set
POSIX permission bits; when omitted, writes default to 0o644.
Run Python functions
Decorate a Python function with@sail.function() and pass it to exec() to
run it inside the sailbox. For functions, exec() waits for completion and
returns the function’s return value directly. Sail runs the function with the
image’s python3.
Python functions are currently supported only for sailboxes running custom
images. We plan to remove this limitation shortly.
background=True is not supported for
functions. Remote exceptions are raised as sail.SailboxFunctionError with the
remote traceback attached.
This beta path sends serialized function payloads and return values through the
existing exec RPC. Keep arguments and return values small; for large dataframes
or artifacts, write data from inside the sailbox and return a small reference.
Expose ports
Passingress_ports when creating the sailbox, start a service inside the VM,
then fetch the listener’s endpoint. A bare port number is exposed over HTTP and
resolves to an HttpEndpoint with a routable url:
1 and 65535. Port 10000 is reserved by
the platform; port 22 is reserved for HTTP but available for raw TCP ingress
(below).
Raw TCP and SSH
Passsail.IngressPort(port, "tcp") to expose a port as raw TCP instead of
HTTP — for SSH, Postgres, or any other TCP protocol. Its listener resolves to a
TcpEndpoint with a host and port that any client dials directly — a raw
byte stream, so no TLS wrapping or client-side config is needed.
Each org can hold a limited number of concurrent raw-TCP endpoints (32 by
default); a create beyond that limit fails with a clear error. Tear down
endpoints you no longer need, or contact us to raise your limit.
The default image ships no SSH server, so a DIY SSH box installs one, exposes
port 22 as TCP, injects your public key, and starts sshd:
listener.wait() returns once sshd is accepting connections — for SSH it waits
for the server banner — after which ssh root@<host> -p <port> connects with no
extra flags.
To restrict which source IPs may connect, pass cidr_allowlist:
cidr_allowlist means any source may connect. cidr_allowlist is a TCP-only control; it is not accepted on HTTP ports.
Exposing a well-known unauthenticated service port (such as Postgres, MySQL, or Redis) as raw TCP with neither a cidr_allowlist nor allow_public=True is rejected, since publishing one of these to the whole internet with no source restriction is rarely intended. Set a cidr_allowlist, or pass allow_public=True to confirm you want it publicly reachable:
Lifecycle
Sailboxes preserve their writable disk, in-memory state, and in-flight network requests across checkpoints and resumes.checkpoint() after important setup, such as installing packages or
fetching remote data. On host failure, Sail restores from the most recent
completed checkpoint and does not replay commands that ran after that
checkpoint.
fork() creates a separate running sailbox from the current in-memory process
state and writable disk. The child gets new Sail identity and networking. Active
TCP connections are reset in the child, while listening sockets can accept new
connections after you expose routes for the child.
Sleep during inference
To automatically sleep a sailbox while a foreground Sail inference call is in flight, include its ID in the request with theX-SailboxId header. Sail will
resume the sailbox after the inference call completes.
Custom images
Start from the arm64 Debian base image and add build steps:apt_install, pip_install, run_commands, env, and build.