opsen
opsen

Files in and out

Reading and writing the sandbox filesystem.

s.fs.write("input.json", b'{"id": 42}')
data = s.fs.read("output.json")

Listing and deleting go through the shell, which is the same channel the file methods use, so the two cannot disagree about where they are:

s.exec("ls -1A")
s.exec("rm scratch.tmp")

Paths are absolute or relative to the working directory

The file API and the shell see the same directory. That sounds obvious and is a common source of bugs in this category: a filesystem API that resolves against one root while exec resolves against another means a file written by one is invisible to the other.

Large files

Transfers are chunked. A write is not one enormous request, because a single command line has a size limit and exceeding it fails in a way that reports success — the write returns, and the file is not there.

Getting results out

Read them, or have the agent write somewhere durable. A sandbox filesystem dies with the session unless the session is suspended rather than killed. For results that must outlive the run, see Persistent storage.