--root-dir (default /workspace). Path confinement explains how paths resolve.
axectl has no file commands. Use the native Files service over gRPC, the REST API on port 8080 when the Agent Sandbox adapter is on (the default), or the MCP file tools. All reach the same engine and follow the same rules.-H "Authorization: Bearer $TOKEN" to each curl and grpcurl command. See Authentication.
Upload a file
An upload writes to an unnamed temporary file (O_TMPFILE) in the target directory, so while bytes arrive nothing is visible in the directory. On commit, axed syncs the file. A replace-mode upload then links it under a temporary .axe-tmp-* name in the same directory and atomically renames that name to the target path, so the path always holds either the old file or the complete new one. A directory listing taken at that moment can briefly show the .axe-tmp-* entry, which already holds the complete contents; watchers never report it. A create-only upload links the file straight to the target path, with no temporary name. If the upload fails or the client vanishes, nothing is left behind. On filesystems without O_TMPFILE, axed writes to a named .axe-tmp-* file in the same directory from the start, so a listing can show it for the whole upload.
axed creates missing parent directories with mode 0755.
- gRPC
- REST
Files.Write is a client stream: one header, any number of data chunks, then one commit.FileInfo. The file appears only on commit. A stream that ends without one fails with ABORTED and leaves nothing. A clean end of stream alone never commits, because a client that vanishes mid-upload, or a proxy, can look like one. Set commit.size to have the commit fail with FAILED_PRECONDITION unless exactly that many bytes arrived.Modes
The mode is applied exactly, ignoring the umask, except that setuid and setgid are always dropped. The same holds for every mode axed sets: appends, new directories, copies and extracted archives.Write modes
Any other native
write_mode value fails with INVALID_ARGUMENT.
Read a file
- gRPC
- REST
Files.Read streams a FileChunk with the file’s info, then its bytes in data chunks. offset and length read a range; length 0 reads to the end.FAILED_PRECONDITION. Reading a FIFO, socket or device fails with INVALID_ARGUMENT.Inspect and list
The native
FileInfo has name, kind (file, directory, or other for FIFOs, sockets and devices), size, mode and modified. REST entries use sandboxd’s field names instead; see File metadata. Listed names are relative to the listed directory, in lexical order, with each directory before its contents. A symlink is listed with its target’s metadata and is never descended into; broken or escaping links are left out. A native listing fails with INVALID_ARGUMENT past 100,000 entries, at any depth, including a listing of direct children. A REST listing fails with 400 past 10,000 entries when it is recursive and deeper than one level; a REST listing of direct children fails only when one directory holds more than 1,048,576 entries. Limit the depth or list a subdirectory. It also fails once the names it returns add up to more than 32 MiB. Each name is a path from the listed directory, so a very deep tree reaches that limit long before the entry limit.
Make directories
- gRPC
- REST
parents, a missing parent fails with NOT_FOUND. If the directory already exists, the call succeeds and leaves it as it is. An existing file at the path fails with ALREADY_EXISTS (REST 409 CONFLICT). The default mode is 0755.
Move, copy and remove
Rules for move and copy:
- axed creates missing parents of the destination.
- An existing destination fails with
ALREADY_EXISTS(REST 409CONFLICT) unless you setoverwrite.overwritereplaces a file with a file, never a directory, in either direction. - axed moves and copies symlinks as links and leaves their targets alone.
- Moving or copying a directory into itself fails with
INVALID_ARGUMENT. - A moved file keeps its contents and identity. A move across filesystems falls back to copy and delete.
- A copied file is written like an upload and appears only when complete. axed builds a copied directory under a temporary name and renames it into place.
- Copies keep permission bits but drop setuid and setgid.
- Copying a FIFO, socket or device fails with
INVALID_ARGUMENT.
- Removing a symlink removes the link, never its target.
- A non-empty directory needs
recursive; without it the call fails withALREADY_EXISTS(REST 409CONFLICT). - Removing the root itself with
recursiveempties it. Withoutrecursiveit fails.
Extract a tar archive
The REST API can unpack a tar or gzipped tar into a directory. The native API has no equivalent; upload the archive and runtar as a process instead.
?mode (default 0755), and any missing parents with 0755. It detects gzip from the archive’s first bytes. It supports regular files, directories and symlinks, writes each file like an upload, and drops setuid and setgid bits from every mode. Directories get their archive mode plus owner rwx.
axed refuses, with the status shown:
extract cannot be combined with append, type or If-None-Match.
Errors
The native API returns gRPC status codes, and the REST API returns an HTTP status with a{"code", "message"} body. Running out of disk space is 507 on REST. Errors lists every mapping.
