Skip to content

Filesystem

cell.write_file("config.json", '{"model": "gpt-4"}')
cell.write_file("data/input.csv", csv_content)
content = cell.read_file("config.json")
print(content) # {"model": "gpt-4"}
entries = cell.list_files("/data/")
for entry in entries:
print(f"{entry.type} {entry.name} ({entry.size} bytes)")
info = cell.file_info("config.json")
print(info.name) # config.json
print(info.type) # file
print(info.size) # 19
print(info.permissions) # rw-r--r--
print(info.modified_time) # 2026-05-14T12:00:00Z
if cell.file_exists("output.txt"):
data = cell.read_file("output.txt")
cell.make_dir("data/processed/2026") # Creates parents
cell.rename_file("old_name.txt", "new_name.txt")
cell.rename_file("data/raw.csv", "data/processed/clean.csv")
cell.remove_file("temp.txt")
cell.remove_file("data/cache/") # Removes directories too

If using the E2B compat layer, the familiar sandbox.files namespace works:

from synapse.e2b_compat import Sandbox
sbx = Sandbox()
sbx.files.write("/home/user/hello.txt", "Hello!")
content = sbx.files.read("/home/user/hello.txt")
entries = sbx.files.list("/home/user/")