Protocol for pluggable memory backends (single, unified).
Backends can store files in different locations (state, filesystem, database, etc.) and provide a uniform interface for file operations.
All file data is represented as dicts with the following structure::
{
"content": str, # Text content (utf-8) or base64-encoded binary
"encoding": str, # "utf-8" for text, "base64" for binary data
"created_at": str, # ISO format timestamp
"modified_at": str, # ISO format timestamp
}
BackendProtocol()abc.ABCNote:
Legacy data may still contain "content": list[str] (lines split on
\\n). Backends accept this for backwards compatibility and emit a
DeprecationWarning.
List all files in a directory with metadata.
Async version of ls.
Read file content with line numbers.
Async version of read.
Search for a literal text pattern in files.
Async version of grep.
Find files matching a glob pattern.
Async version of glob.
Write content to a new file in the filesystem, error if file exists.
Async version of write.
Perform exact string replacements in an existing file.
Async version of edit.
Upload multiple files to the sandbox.
This API is designed to allow developers to use it either directly or by exposing it to LLMs via custom tools.
Async version of upload_files.
Download multiple files from the sandbox.
This API is designed to allow developers to use it either directly or by exposing it to LLMs via custom tools.
Async version of download_files.
List all files in a directory with metadata.
Use ls instead.
Async version of ls_info.
Use als instead.
Find files matching a glob pattern.
Use glob instead.
Async version of glob_info.
Use aglob instead.
Search for a literal text pattern in files.
Use grep instead.
Async version of grep_raw.
Use agrep instead.