Option C Tools
Loading...
Searching...
No Matches
oct.mcp.sandbox.SandboxBackend Class Reference
Inheritance diagram for oct.mcp.sandbox.SandboxBackend:
[legend]
Collaboration diagram for oct.mcp.sandbox.SandboxBackend:
[legend]

Public Member Functions

tuple[int, str, str] run (self, list[str] cmd, dict[str, str] env, Path cwd, int timeout, int|None memory_limit_bytes)

Detailed Description

Protocol for OS-level sandbox backends.

Each backend wraps the subprocess call with platform-specific
isolation (network namespace, resource limits, etc.). The backend
receives a sanitised environment and returns raw
``(exit_code, stdout, stderr)`` — output capping and error handling
live in :class:`SandboxExecutor`.

Definition at line 217 of file sandbox.py.

Member Function Documentation

◆ run()

tuple[int, str, str] oct.mcp.sandbox.SandboxBackend.run ( self,
list[str] cmd,
dict[str, str] env,
Path cwd,
int timeout,
int | None memory_limit_bytes )
Run *cmd* and return ``(exit_code, stdout, stderr)``.

Parameters
----------
cmd
    Command + arguments list. Must not use ``shell=True``.
env
    Sanitised environment dict.
cwd
    Working directory (validated project root).
timeout
    Maximum wall-clock seconds.
memory_limit_bytes
    Virtual memory ceiling in bytes, or ``None`` to skip.
    Implementations on POSIX apply this via ``setrlimit``; on
    Windows it is silently ignored.

Definition at line 227 of file sandbox.py.


The documentation for this class was generated from the following file: