feat(runtime): pluggable sandbox backend registry

``STRIX_RUNTIME_BACKEND`` was already declared on ``Config`` but never
read — ``session_manager`` hard-coded ``StrixDockerSandboxClient`` plus
``DockerSandboxClientOptions`` plus ``docker.from_env()`` directly into
the call site. Adding a second backend would have meant retrofitting
every Docker-specific import.

Move all of that behind a registry:

- ``strix/runtime/backends.py``: maps backend names to async factories
  ``(image, manifest, exposed_ports) -> (client, session)``. Ships with
  ``"docker"``; ``register_backend`` lets downstream users plug in
  Daytona / K8s / Modal / etc. without forking.
- Each backend's deps are imported lazily inside its factory, so a
  K8s-only deployment doesn't need ``docker-py`` installed (and
  vice-versa).
- ``session_manager`` reads the config name, looks up the backend,
  calls it. Zero Docker imports remain.
- Unknown backend name raises ``ValueError`` with the supported list,
  so ``STRIX_RUNTIME_BACKEND=docke`` typos surface immediately.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
0xallam
2026-04-25 15:02:51 -07:00
co-authored by Claude Opus 4.7
parent fe5f749e13
commit 6990fd4ef1
4 changed files with 118 additions and 12 deletions
+9 -4
View File
@@ -1,10 +1,15 @@
"""Strix runtime — Docker-backed sandbox lifecycle on top of the Agents SDK.
"""Strix runtime — pluggable sandbox lifecycle on top of the Agents SDK.
- :class:`strix.runtime.docker_client.StrixDockerSandboxClient` —
``DockerSandboxClient`` subclass that injects ``NET_ADMIN`` /
``NET_RAW`` capabilities and ``host.docker.internal`` extra-hosts.
- :mod:`.backends` — registry mapping ``STRIX_RUNTIME_BACKEND`` values
to async factories that bring up a ``(client, session)`` pair. Ships
with ``"docker"`` out of the box; ``register_backend`` lets downstream
users add Daytona / K8s / Modal / etc. without forking.
- :mod:`.session_manager` — ``create_or_reuse`` / ``cleanup`` keyed
by scan id; bundles the SDK session with a ready Caido client.
- :mod:`.caido_bootstrap` — runtime-agnostic Caido auth dance via
``session.exec``.
- :class:`strix.runtime.docker_client.StrixDockerSandboxClient` —
``DockerSandboxClient`` subclass that injects ``NET_ADMIN`` /
``NET_RAW`` capabilities and ``host.docker.internal`` extra-hosts
(used only by the Docker backend).
"""