OpenShell¶
Backend¶
openshell
¶
OpenShell sandbox backend for agentic-ci.
OpenShellBackend(workdir='.', image=None, policy=None, extra_env=None, approval_mode=None, *, harness)
¶
Bases: Backend
Runs an AI agent inside an OpenShell sandbox.
OpenShell provides security-focused sandboxing with network policy enforcement, filesystem isolation, and Landlock-based access control. Authentication is handled through the OpenShell google-cloud provider, which injects GCP credentials via the supervisor proxy. The agent uses its native Vertex AI integration directly.
Unlike PodmanBackend, which bind-mounts the workdir so changes are visible immediately on the host, OpenShellBackend copies the workdir into the sandbox on setup() and copies it back after run() completes. Only changes inside the workdir are reflected back to the host; files written elsewhere in the sandbox (e.g. /tmp) are not retrieved.
Source code in src/agentic_ci/backends/openshell/__init__.py
Gateway¶
gateway
¶
OpenShell gateway lifecycle management.
is_running()
¶
Check if the OpenShell gateway is registered and healthy.
Source code in src/agentic_ci/backends/openshell/gateway.py
start()
¶
Start the OpenShell gateway with the podman driver.
Starts the podman API socket, generates TLS certificates for sandbox JWT auth, writes a gateway config, launches openshell-gateway in the background, registers it with the CLI, and blocks until the health endpoint responds.
If any step fails after processes have been spawned, cleanup is performed automatically to avoid orphaned processes.
Source code in src/agentic_ci/backends/openshell/gateway.py
stop()
¶
Terminate the gateway and podman service processes.
Deregisters the gateway from the CLI first, then discovers and kills
processes by port and socket rather than requiring stored handles, so
this works across process boundaries (e.g. a separate
agentic-ci stop invocation).
Source code in src/agentic_ci/backends/openshell/gateway.py
Sandbox¶
sandbox
¶
OpenShell sandbox lifecycle management.
exists()
¶
create(image=None, policy_path=None, otel_port=None, workdir='.', approval_mode=None)
¶
Create a persistent sandbox with the CI provider attached.
The sandbox is created first, then the network policy is applied
via openshell policy update --wait to ensure the supervisor
has compiled and activated the rules before the agent starts.
Source code in src/agentic_ci/backends/openshell/sandbox.py
upload(local_path)
¶
download(sandbox_path, local_dest)
¶
Download a path from the sandbox to a local destination.
exec_cmd(cmd)
¶
Run a command inside the sandbox. Returns the CompletedProcess.
exec_cmd_streaming(cmd)
¶
Run a command inside the sandbox with stdout piped. Returns a Popen.
Source code in src/agentic_ci/backends/openshell/sandbox.py
Policy¶
policy
¶
Policy resolution for OpenShell sandbox.
resolve_endpoints(flag_path=None, workdir='.')
¶
Resolve the endpoint list to use for policy update.
Merges the built-in defaults with extra endpoints from, in priority order:
- Explicit
--policyflag path .agentic-ci/openshell-policy.ymlin workdir
Returns a list of endpoint strings for openshell policy update --add-endpoint.