LocalShellBackend: Filesystem backend with unrestricted local shell execution.
This backend extends FilesystemBackend to add shell command execution on
the local host system. It provides NO sandboxing or isolation - all operations
run directly on the host machine with full system access.
Default timeout in seconds for shell command execution.
Collect text-mode output across polling attempts, joining only at EOF.
Unlike Popen.communicate, a timed-out attempt does not build a snapshot of
all output read so far. Chunks stay buffered for the next attempt, including
partial encoded characters and newline sequences. Nothing else may read the
pipes while this reader is in use.
The caller owns termination and pipe cleanup if communicate raises.
Read both captured pipes by polling instead of with reader threads.
subprocess.communicate starts a thread for each pipe on Windows. Those
threads hold the pipe until the write end closes, so a caller cannot close
the pipes to stop waiting for a descendant that inherited them. This reader
polls instead, which leaves the caller free to close the pipes at any time.
The process must be in text mode, because the reader takes the encoding and
error handler from each pipe. Nothing may read the pipes before this reader
is created. Each pipe is decoded incrementally as it is read, so repeated
calls to communicate keep the text already decoded, and an encoded
character split across two reads is held until the rest of it arrives.
The caller owns termination and pipe cleanup if communicate raises.
Backend that reads and writes files directly from the filesystem.
Files are accessed using their actual filesystem paths. Relative paths are resolved relative to the current working directory. Content is read/written as plain text, and metadata (timestamps) are derived from filesystem stats.
This backend grants agents direct filesystem read/write access. Use with caution and only in appropriate environments.
Appropriate use cases:
Inappropriate use cases:
StateBackend, StoreBackend, or
SandboxBackend insteadSecurity risks:
.env files)Recommended safeguards:
StateBackend, StoreBackend or SandboxBackendIn general, we expect this backend to be used with Human-in-the-Loop (HITL) middleware, or within a properly sandboxed environment if you need to run untrusted workloads.
virtual_mode=True is primarily for virtual path semantics (for example with
CompositeBackend). It can also provide path-based guardrails by blocking
traversal (.., ~) and absolute paths outside root_dir, but it does not
provide sandboxing or process isolation. Set virtual_mode=False only for
trusted local development workflows that require unrestricted host paths.
Result of code execution.
Simplified schema optimized for LLM consumption.
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().
Filesystem backend with unrestricted local shell command execution.
This backend extends FilesystemBackend to add shell command execution
capabilities. Commands are executed directly on the host system without any
sandboxing, process isolation, or security restrictions.
This backend grants agents BOTH direct filesystem access AND unrestricted shell execution on your local machine. Use with extreme caution and only in appropriate environments.
Appropriate use cases:
Inappropriate use cases:
Use StateBackend, StoreBackend, or extend BaseSandbox for production.
Security risks:
.env files, SSH keys, etc.)Recommended safeguards:
Since shell access is unrestricted and can bypass filesystem restrictions:
BaseSandbox
to create a properly isolated backend (Docker containers, VMs, or
other sandboxed execution environments)virtual_mode=True and path-based restrictions provide NO security
with shell access enabled, since commands can access any path on
the system