Runtime Module¶
Tool runtime module.
- class atloop.runtime.ToolResult(ok: bool, stdout: str, stderr: str, meta: Dict[str, Any])[source]¶
Bases:
objectResult of tool execution.
- class atloop.runtime.SandboxAdapter(config: SandboxConfig, sandbox_session_id: str)[source]¶
Bases:
objectAdapter for noxrunner sandbox execution.
- __init__(config: SandboxConfig, sandbox_session_id: str)[source]¶
Initialize sandbox adapter.
- Parameters:
config – Sandbox configuration
sandbox_session_id – Unique sandbox session identifier
- download_workspace(workspace_path: str) bool[source]¶
Download workspace from sandbox to local directory.
This method delegates to noxrunner’s download_workspace method, which handles all the details of downloading and extracting files regardless of the backend type (local or remote).
- Parameters:
workspace_path – Local workspace path to download to
- Returns:
True if successful
- exec(cmd: List[str], workdir: str = '/workspace', env: Dict[str, str] | None = None, timeout_seconds: int = 30) Dict[source]¶
Execute a command in the sandbox (using exec, not exec_shell). This returns the correct exit code from the command itself, not from sh.
- Parameters:
cmd – Command to execute (list of strings)
workdir – Working directory
env – Environment variables
timeout_seconds – Command timeout
- Returns:
Dict with exitCode, stdout, stderr, durationMs
- exec_shell(command: str, workdir: str = '/workspace', env: Dict[str, str] | None = None, timeout_seconds: int = 30) Dict[source]¶
Execute shell command in sandbox.
- Parameters:
command – Shell command to execute
workdir – Working directory
env – Environment variables
timeout_seconds – Command timeout
- Returns:
Dict with exitCode, stdout, stderr, durationMs
- atloop.runtime.__getattr__(name: str)[source]¶
Lazy import for ToolRuntime to avoid circular imports.
SandboxAdapter¶
- class atloop.runtime.sandbox_adapter.SandboxAdapter(config: SandboxConfig, sandbox_session_id: str)[source]¶
Bases:
objectAdapter for noxrunner sandbox execution.
- __init__(config: SandboxConfig, sandbox_session_id: str)[source]¶
Initialize sandbox adapter.
- Parameters:
config – Sandbox configuration
sandbox_session_id – Unique sandbox session identifier
- upload_workspace(workspace_path: str) bool[source]¶
Upload workspace to sandbox.
- Parameters:
workspace_path – Local workspace path
- Returns:
True if successful
- initialize_git() bool[source]¶
Initialize git repository in sandbox if not exists.
- Returns:
True if successful
- exec_shell(command: str, workdir: str = '/workspace', env: Dict[str, str] | None = None, timeout_seconds: int = 30) Dict[source]¶
Execute shell command in sandbox.
- Parameters:
command – Shell command to execute
workdir – Working directory
env – Environment variables
timeout_seconds – Command timeout
- Returns:
Dict with exitCode, stdout, stderr, durationMs
- exec(cmd: List[str], workdir: str = '/workspace', env: Dict[str, str] | None = None, timeout_seconds: int = 30) Dict[source]¶
Execute a command in the sandbox (using exec, not exec_shell). This returns the correct exit code from the command itself, not from sh.
- Parameters:
cmd – Command to execute (list of strings)
workdir – Working directory
env – Environment variables
timeout_seconds – Command timeout
- Returns:
Dict with exitCode, stdout, stderr, durationMs
- download_workspace(workspace_path: str) bool[source]¶
Download workspace from sandbox to local directory.
This method delegates to noxrunner’s download_workspace method, which handles all the details of downloading and extracting files regardless of the backend type (local or remote).
- Parameters:
workspace_path – Local workspace path to download to
- Returns:
True if successful