sandboxes
sandboxes
__all__
module-attribute
__all__ = [
"DockerSandbox",
"DockerSbxSandbox",
"SandboxBackend",
"SandboxSession",
"WorkspaceFileMixin",
]
DockerSandbox
docker_args
class-attribute
instance-attribute
docker_args: list[str] = Field(default_factory=list)
env
class-attribute
instance-attribute
env: dict[str, str] = Field(default_factory=dict)
id
class-attribute
instance-attribute
id: str = 'docker'
image
class-attribute
instance-attribute
image: str = 'python:3.12-slim'
model_config
class-attribute
instance-attribute
model_config = ConfigDict(arbitrary_types_allowed=True)
name
class-attribute
instance-attribute
name: str | None = None
remove_on_exit
class-attribute
instance-attribute
remove_on_exit: bool = True
workdir
class-attribute
instance-attribute
workdir: str = '/workspace'
workspace
instance-attribute
workspace: Path
cleanup
cleanup(session: SandboxSession) -> None
collect
collect(session: SandboxSession) -> RunArtifacts
prepare
prepare(
agent: AgentLike, run_config: RunConfigLike | None
) -> SandboxSession
run
run(
session: SandboxSession, command: list[str]
) -> CommandResult
DockerSbxSandbox
branch
class-attribute
instance-attribute
branch: str | None = None
codex_auth_from_host
class-attribute
instance-attribute
codex_auth_from_host: bool = False
cpus
class-attribute
instance-attribute
cpus: int | None = None
force_recreate
class-attribute
instance-attribute
force_recreate: bool = False
id
class-attribute
instance-attribute
id: str = 'docker_sbx'
memory
class-attribute
instance-attribute
memory: str | None = None
model_config
class-attribute
instance-attribute
model_config = ConfigDict(arbitrary_types_allowed=True)
name
class-attribute
instance-attribute
name: str | None = None
network_allow
class-attribute
instance-attribute
network_allow: list[str] = Field(default_factory=list)
remove_on_exit
class-attribute
instance-attribute
remove_on_exit: bool = True
secret_env
class-attribute
instance-attribute
secret_env: dict[str, str] = Field(default_factory=dict)
secret_oauth
class-attribute
instance-attribute
secret_oauth: list[str] = Field(default_factory=list)
secret_oauth_refresh
class-attribute
instance-attribute
secret_oauth_refresh: list[str] = Field(
default_factory=list
)
workspace
instance-attribute
workspace: Path
check_agent_secrets
classmethod
check_agent_secrets(
agent_id: str, *, timeout_seconds: int = 10
) -> None
check_available
classmethod
check_available() -> None
check_ready
classmethod
check_ready(*, timeout_seconds: int = 10) -> None
cleanup
cleanup(session: SandboxSession) -> None
collect
collect(session: SandboxSession) -> RunArtifacts
ensure_agent_auth
ensure_agent_auth(
agent: AgentLike,
run_config: RunConfigLike | None = None,
*,
stream_output: bool = False,
) -> None
ensure_agent_secret
ensure_agent_secret(
agent_id: str,
*,
timeout_seconds: int = 10,
stream_output: bool = False,
) -> None
has_global_secret
classmethod
has_global_secret(
service: str, *, timeout_seconds: int = 10
) -> bool
is_available
classmethod
is_available() -> bool
is_ready
classmethod
is_ready(*, timeout_seconds: int = 10) -> bool
prepare
prepare(
agent: AgentLike, run_config: RunConfigLike | None
) -> SandboxSession
run
run(
session: SandboxSession, command: list[str]
) -> CommandResult
set_global_oauth_secret
classmethod
set_global_oauth_secret(
service: str,
*,
timeout_seconds: int = 120,
stream_output: bool = False,
) -> None
set_global_secret
classmethod
set_global_secret(
service: str, value: str, *, timeout_seconds: int = 10
) -> None
SandboxBackend
id
instance-attribute
id: str
name
instance-attribute
name: str | None
cleanup
cleanup(session: SandboxSession) -> None
Stop/remove sandbox if configured.
collect
collect(session: SandboxSession) -> RunArtifacts
Collect diff, logs, output files.
prepare
prepare(
agent: AgentLike, run_config: RunConfigLike | None
) -> SandboxSession
Create workspace, worktree, sandbox, pod, etc.
run
run(
session: SandboxSession, command: list[str]
) -> CommandResult
Execute command inside sandbox.
SandboxSession
metadata
class-attribute
instance-attribute
metadata: dict[str, Any] = Field(default_factory=dict)
sandbox_name
class-attribute
instance-attribute
sandbox_name: str | None = None
workspace
instance-attribute
workspace: Path
WorkspaceFileMixin
workspace
instance-attribute
workspace: Path
delete_file
delete_file(path: str | Path) -> None
get_bytes
get_bytes(path: str | Path) -> bytes
get_file
get_file(
path: str | Path, *, encoding: str = "utf-8"
) -> str
list_files
list_files(pattern: str = '**/*') -> list[Path]
put_bytes
put_bytes(path: str | Path, content: bytes) -> Path
put_file
put_file(
path: str | Path,
content: str,
*,
encoding: str = "utf-8",
) -> Path