archil package on PyPI. It’s a pure-Python control-plane client: create disks, list and inspect them, manage who can mount them, run commands against them with Disk.exec, and read and write their contents through an S3-compatible object API.
archil talks to the Archil control plane over HTTPS and has no native dependencies. It requires Python 3.10 or later.
Every method works both synchronously and asynchronously from a single implementation: disk.put_object(...) blocks, while disk.put_object.aio(...) returns a coroutine you can await. See Async below.
Looking for the FUSE mount client? That’s the
archil CLI, which mounts a disk as a real local filesystem. The Python SDK does not mount disks; it talks to the control plane, runs serverless commands, and reads and writes objects over HTTPS.Configuration
The recommended pattern is a one-timeconfigure call, then the module-level helpers:
ARCHIL_API_KEY, ARCHIL_REGION) if omitted, so in most environments you can skip configure entirely and let the SDK read the environment.
For multi-tenant scripts that need multiple credentials in one process, instantiate Archil directly instead of using the module-level configure:
The API key is an account-level credential and is not the same thing as a disk token. API keys authenticate calls to the control plane (everything in this page); a disk token grants mount access to a single disk. See the disk users concept page.
Managing disks
Disk object itself, not top-level functions:
Executing commands
Disk.exec(command) runs a shell command inside a container with the file system already mounted, and returns stdout, stderr, exit code, and timing. See the Serverless Execution concept page for the full picture.
execute_ms — the wall-clock time your command runs — in 1ms increments, with a 100ms minimum per call. Queue time is not billed. stdout and stderr are each capped at 128 KiB per invocation — pipe larger outputs to a file on the disk instead.
For multi-disk execs (mount several disks at once, optionally pinned to a subdirectory or read-only), call archil.exec(...) instead of Disk.exec. Each disk is mounted at its own relative path; pass a Disk, a disk-id string, or an ExecMountSpec for finer control:
exec into an AI agent loop.
Searching files
Disk.grep(...) searches the files on a disk for lines matching a regular expression, fanning the listing and matching out across many ephemeral containers so the search scales across many machines instead of one. Reach for it instead of exec("grep …") whenever you just want matching lines. See Search Files for the full model.
max_duration_seconds— wall-clock deadline (default 30, capped at 30).concurrency— max parallel workers (default 50). More workers scan a large dataset faster, at proportionally more compute.max_results— short-circuit once this many matches are collected (default 1000).
stopped_reason — it tells you whether the search was exhaustive. When it stops early, the returned matches are a sample of whichever workers reported first, not the lexicographically first N:
stopped_reason | Meaning |
|---|---|
completed | Every file under the directory was scanned successfully. The matches are exhaustive. |
max_results | Stopped after collecting max_results matches before scanning everything. |
deadline | Hit max_duration_seconds before scanning everything. |
incomplete | The pipeline finished but one or more batches errored (invalid regex, unreadable file). Results may be partial. |
list_failed | Directory listing failed; only partial results, if any, are present. |
Reading and writing objects
ADisk doubles as an S3-compatible bucket: read, write, delete, and list its files by key without mounting it. These methods talk to Archil’s S3 endpoint using your same API key — no separate S3 credentials or SigV4 signing on your part.
list_objects auto-paginates by default, returning every matching key. The first argument is a key prefix; a non-recursive listing (the default) returns the immediate level as objects plus subdirectory common_prefixes:
s3_base_url to Archil(...) (or set the ARCHIL_S3_BASE_URL env var).
Async
Every method onArchil, Disks, Disk, and Tokens has an .aio variant that returns a coroutine. The module-level helpers (configure, create_disk, get_disk, etc.) are synchronous convenience wrappers, so from async code, construct Archil(...) directly and use .aio:
Managing API keys
API keys are account-level, so these helpers live at the top level rather than on aDisk:
Error handling
All SDK errors extendArchilError, so except ArchilError handles control-plane and S3 failures uniformly. Object-API failures raise ArchilS3Error with status (HTTP status), code (the S3 error code, e.g. "NoSuchKey"), request_id, and the raw body on raw:
get_object on a missing key raises a 404 — use head_object / object_exists to probe without catching.
Supported regions
| Region | Provider |
|---|---|
aws-us-east-1 | AWS |
aws-us-west-2 | AWS |
aws-eu-west-1 | AWS |
gcp-us-central1 | GCP |