Composite backend that routes file operations by path prefix.
Routes operations to different backends based on path prefixes. Use this when you need different storage strategies for different paths (e.g., state for temp files, persistent store for memories).
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": list[str], # Lines of text content "created_at": str, # ISO format timestamp "modified_at": str, # ISO format timestamp }
Result from backend edit operations.
Result of code execution.
Simplified schema optimized for LLM consumption.
Result of a single file download operation.
The response is designed to allow partial success in batch operations. The errors are standardized using FileOperationError literals for certain recoverable conditions for use cases that involve LLMs performing file operations.
Structured file listing info.
Minimal contract used across backends. Only "path" is required. Other fields are best-effort and may be absent depending on backend.
Result of a single file upload operation.
The response is designed to allow partial success in batch operations. The errors are standardized using FileOperationError literals for certain recoverable conditions for use cases that involve LLMs performing file operations.
Structured grep match entry.
Extension of BackendProtocol that adds shell command execution.
Designed for backends running in isolated environments (containers, VMs, remote hosts).
Adds execute()/aexecute() for shell commands and an id property.
See BaseSandbox for a base class that implements all inherited file
operations by delegating to execute().
Result from backend write operations.
Backend that stores files in agent state (ephemeral).
Uses LangGraph's state management and checkpointing. Files persist within a conversation thread but not across threads. State is automatically checkpointed after each agent step.
Special handling: Since LangGraph state must be updated via Command objects (not direct mutation), operations return Command objects instead of None. This is indicated by the uses_state=True flag.
Routes file operations to different backends by path prefix.
Matches paths against route prefixes (longest first) and delegates to the corresponding backend. Unmatched paths use the default backend.