Agent Sandbox Registry

python-sdk

Decision: Files Module (L4)

无中文版

.agents/notes/implemented/feature/2026-09-02-api-files.md

Decision: Files Module (L4)

Status: implemented Implemented: 2026-09-02

Problem

Users need file operations in sandboxes including read, write, upload, download, and directory watching.

Decision

api/files.py — FilesModule with: - read(path, encoding) → str | bytes - write(path, data, encoding) → None - list(path) → list[FileInfo] - upload(local_path, remote_path) → None (convenience: read local + write remote) - download(remote_path, local_path) → None (convenience: read remote + write local) - exists(path) → bool - remove(path) → None - make_dir(path) → None - watch(path) → AsyncIterator[FileEvent] (streaming directory watch)

Large file support: chunked upload/download for files > 5MB.

API Design

class FilesModule:
    async def read(self, path: str, encoding: str = "utf-8") -> str | bytes: ...
    async def write(self, path: str, data: str | bytes, encoding: str = "utf-8") -> None: ...
    async def list(self, path: str) -> list[FileInfo]: ...
    async def upload(self, local_path: str, remote_path: str) -> None: ...
    async def download(self, remote_path: str, local_path: str) -> None: ...
    async def exists(self, path: str) -> bool: ...
    async def remove(self, path: str) -> None: ...
    async def make_dir(self, path: str) -> None: ...
    def watch(self, path: str) -> AsyncIterator[FileEvent]: ...

Implementation

Alternatives considered

Dependencies

Test Strategy

Acceptance criteria