- Add Config class with all env var defaults in one place - Auto-load saved config on startup (env vars take precedence) - Auto-save config after successful LLM warm-up - Replace scattered os.getenv() calls with Config.get() Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
29 lines
772 B
Python
29 lines
772 B
Python
from strix.config import Config
|
|
|
|
from .runtime import AbstractRuntime
|
|
|
|
|
|
class SandboxInitializationError(Exception):
|
|
"""Raised when sandbox initialization fails (e.g., Docker issues)."""
|
|
|
|
def __init__(self, message: str, details: str | None = None):
|
|
super().__init__(message)
|
|
self.message = message
|
|
self.details = details
|
|
|
|
|
|
def get_runtime() -> AbstractRuntime:
|
|
runtime_backend = Config.get("strix_runtime_backend")
|
|
|
|
if runtime_backend == "docker":
|
|
from .docker_runtime import DockerRuntime
|
|
|
|
return DockerRuntime()
|
|
|
|
raise ValueError(
|
|
f"Unsupported runtime backend: {runtime_backend}. Only 'docker' is supported for now."
|
|
)
|
|
|
|
|
|
__all__ = ["AbstractRuntime", "SandboxInitializationError", "get_runtime"]
|