sandbox.files.
write
Write a file at an absolute path. Parent directories are created automatically.
Accepted content types:
read
Read a file as raw bytes.
readText / read_text
Read a file and decode as UTF-8.
downloadDir / download_dir
Download a directory as a ZIP archive. Returns the raw zip bytes — entries are
prefixed with the directory’s base name (e.g. output/log.txt), and symlinks
are skipped.
The server decides file-vs-directory: if
path points at a regular file, its
bytes are streamed back as-is (not zipped) — use read for files.
Round-trip example
Path rules
- Paths must start with
/ - Paths must not contain
..segments - Parent directories are created automatically on
write
Errors
Commonly raised:NotFoundError- file or directory does not exist (on read / downloadDir)ValidationError- invalid path (relative, contains.., or malformed)AuthenticationError- access token invalid or sandbox was deletedTimeoutError/SandboxTimeoutError- the optional timeout elapsed