rlmesh.jax.SandboxModel

classExperimentalfrom rlmesh.jax import SandboxModel[source]

A model served from an isolated container.

SandboxModel(
    source: object,
    /,
    *,
    runtime: SandboxRuntime | None = None,
    **params: object,
)

The source is a prebuilt rlmesh-serving image you built yourself (BYO), given as a bare smolvla:latest or an explicit image:///docker:// tag: the image is run directly and its baked CMD drives it. **params are the model’s construction params – forwarded into the container as the load(**binding) binding (RLMESH_MAKE_KWARGS), validated against the model’s declared params before weights load.

A SandboxRuntime (runtime=) sets docker run flags – gpus for CUDA compute, or devices=["nvidia.com/gpu=all"] (a CDI ref, full graphics+compute) and volumes=[...] for large local checkpoints/assets. A model is always a prebuilt image, so there is no build config (no SandboxBuild).

serve

function[source]
serve() -> SandboxModel

Start a long-lived container serving the policy as a model endpoint.

The prebuilt image:// image is run in serve mode.

Idempotent: a second call returns the already-running handle. The endpoint is reachable at address until shutdown().

session

function[source]
session(
    env: EnvTarget,
    *,
    instruction: str | None = None,
    close_env: bool = False,
    trust_entrypoints: bool | None = None,
    execution_horizon: int = 1,
    connect_timeout_seconds: float = 30.0,
    view: ViewArg = None,
    workflow_edition: str | None = None,
) -> Session[Any, Any]

Serve this model and bind it to env, returning a neutral rlmesh.Session.

The managed sibling of rlmesh.RemoteModel.session(): starts the model container (idempotent), then opens a route configured from the env’s contract so the same drive loop works for both pairs::

with rlmesh.SandboxEnv(“gym://CartPole-v1”) as env: sess = rlmesh.session( rlmesh.SandboxModel(“image://my-model:latest”), env ) obs, _ = sess.reset() while not sess.done: obs, reward, terminated, truncated, _ = sess.step(sess.predict(obs))

Closing the session stops the container it started. instruction / trust_entrypoints cannot be honored by a served container and raise ValueError when set rather than being silently dropped. view opts into the built-in live viewer over this session’s env loop (see rlmesh.run()). execution_horizon requests open-loop action chunking: the runtime executes that many actions of each predicted chunk before re-planning (1 = re-plan every step; only engages if the served policy defines a chunk corner). Retries the connection while the container starts, up to connect_timeout_seconds.

address

property[source]
property address: str

container_id

property[source]
property container_id: str

shutdown

function[source]
shutdown() -> None

Stop the served container, if any. Idempotent; safe to call repeatedly.