Feature

Filesystem Operations

Read, write, upload, and download files programmatically. Full filesystem access with persistent storage within sandboxes.

filesystem.py
1from hopx_ai import Sandbox
2
3sandbox = Sandbox.create(template="code-interpreter")
4
5# Write a file
6sandbox.files.write(
7    "/workspace/data.json",
8    '{"name": "Alice", "age": 30}'
9)
10
11# Read a file
12content = sandbox.files.read("/workspace/data.json")
13print(f"Content: {content}")
14
15# List directory contents
16files = sandbox.files.list("/workspace")
17for f in files:
18    print(f"{f.name} - {f.size} bytes")
19
20# Upload a local file
21sandbox.files.upload("./local_file.txt", "/workspace/uploaded.txt")
22
23# Download a file
24sandbox.files.download("/workspace/data.json", "./downloaded.json")
25
26# Remove a file
27sandbox.files.remove("/workspace/data.json")

Read & Write

Read and write files programmatically with simple API calls

Upload Files

Transfer files from your local system to the sandbox

Download Files

Retrieve files from the sandbox to your local system

File Watching

Monitor files for changes in real-time

Full File Access

Manage files in your sandbox with simple API calls.