disk.exec(command) spins up a container with the file system already mounted, runs an arbitrary shell command to completion, and returns stdout, stderr, exit code, and timing information. You pay only for the time the command is actively running.
Serverless execution is available today for disks in our AWS regions (aws-us-east-1, aws-us-west-2, aws-eu-west-1).
disk CLI:
When to use disk.exec
Reach for serverless execution when:
- You only want a result, not the raw data. A full-text search across a bucket returns a few kilobytes; downloading the bucket to
greplocally could be gigabytes. - You need to fan out work across the same data. Every
execgets its own container.Promise.allof N execs is a map-reduce. - You’re giving an agent a bash tool. Persistent file system + ephemeral compute is the model agents want, and
disk.execgives you both in one SDK call. - You don’t want to manage compute lifecycle. No sandbox to warm up, no instance to size, no cold start to pay for when you’re idle.
How it works
When you calldisk.exec:
- The request is sent to the Archil control plane and queued for a runtime container.
- A container is started (or an existing warm one is claimed) with the file system mounted at
/mnt/data. - Your command runs inside the container with
bash -c "<command>". - When the command exits, stdout, stderr, and the exit code are returned. The container is released.
ExecResult includes a timing object with three fields:
| Field | Meaning |
|---|---|
totalMs | End-to-end wall clock, measured on the server. |
queueMs | Time spent queueing, scheduling, booting/claiming a container, and mounting the filesystem. |
executeMs | Time your command itself ran. |
executeMs — the wall-clock time your command runs — in 1ms increments, with a 100ms minimum per call. Queue time is not billed. See the pricing page for current rates.
Working directory and environment
Everyexec runs with the disk as the working directory — commands can reference files on the disk using relative paths. The runtime image includes common Unix tools (coreutils, grep, sed, awk, find, curl, jq, python3, node) — if you need a specific interpreter, write the script to the disk first (through a mounted client or a prior exec) and invoke it by path.
Consistency with other clients
Serverless execs are regular Archil clients — they use the same read-after-write consistency model as any mounted client. A file written by a FUSE mount is visible to the nextexec that reads it, and vice versa. For concurrent writes, the usual delegation rules apply; most short-lived execs run fine as non-exclusive writers in their own subdirectory.
Limits
- Command timeout: the HTTP response returns after 5 minutes; longer-running work should be broken up into multiple
execcalls that communicate through files on the disk. - Output size: stdout and stderr are each capped at 128 KiB per invocation. If you hit the cap, the output is truncated and a trailer is appended noting how many bytes were dropped. Pipe large outputs to a file on the disk instead.
- Concurrency: Per-disk concurrency limits are generous but not unbounded — contact us before running large fan-outs.