runner
runner
¶
Container runner and sandboxed agent wrapper.
ContainerRunner manages Docker container lifecycle for sandboxed
agent execution. SandboxedAgent wraps any BaseAgent to run
inside a container, following the GuardrailsEngine wrapper pattern.
Classes¶
ContainerRunner
¶
ContainerRunner(*, image: str = '', timeout: int = 0, mount_allowlist_path: str = '', max_concurrent: int = 5, runtime: str = 'docker')
Manages Docker container lifecycle for sandboxed execution.
| PARAMETER | DESCRIPTION |
|---|---|
image
|
Docker image to run. Defaults to
TYPE:
|
timeout
|
Maximum execution time in seconds.
TYPE:
|
mount_allowlist_path
|
Path to a JSON mount-allowlist file.
TYPE:
|
max_concurrent
|
Maximum number of concurrent containers.
TYPE:
|
runtime
|
Container runtime binary name (
TYPE:
|
Source code in src/openjarvis/sandbox/runner.py
Functions¶
run
¶
run(input_data: Dict[str, Any], *, workspace: str = '', mounts: Optional[List[str]] = None, secrets: Optional[Dict[str, str]] = None, env: Optional[Dict[str, str]] = None) -> Dict[str, Any]
Spawn a container, send input, parse output.
| PARAMETER | DESCRIPTION |
|---|---|
input_data
|
JSON-serializable payload sent to the container's stdin.
TYPE:
|
workspace
|
Working directory inside the container.
TYPE:
|
mounts
|
Host paths to bind-mount (read-only).
TYPE:
|
secrets
|
Key-value pairs injected into input (not env vars).
TYPE:
|
env
|
Environment variables for the container.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict
|
Parsed JSON output from the container. |
Source code in src/openjarvis/sandbox/runner.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
stop
¶
Force-stop a running container.
Source code in src/openjarvis/sandbox/runner.py
cleanup_orphans
¶
Remove orphaned sandbox containers.
Source code in src/openjarvis/sandbox/runner.py
SandboxedAgent
¶
SandboxedAgent(agent: BaseAgent, runner: ContainerRunner, *, engine: Optional[InferenceEngine] = None, model: str = '', workspace: str = '', mounts: Optional[List[str]] = None, secrets: Optional[Dict[str, str]] = None, bus: Optional[EventBus] = None)
Bases: BaseAgent
Transparent wrapper that runs any BaseAgent in a container.
Follows the GuardrailsEngine wrapper pattern — the wrapped
agent's configuration is serialized and sent to the container.
Source code in src/openjarvis/sandbox/runner.py
Functions¶
run
¶
run(input: str, context: Optional[AgentContext] = None, **kwargs: Any) -> AgentResult
Delegate execution to the container runner.