rlmesh.run
Drive model against env to completion and return a RunResult.
run(
model: object,
env: EnvTarget,
*,
seeds: Sequence[int] | None = None,
episodes: int | None = None,
max_episode_steps: int | None = None,
max_episode_seconds: float | None = None,
hooks: RunHooks | None = None,
instruction: str | None = None,
close_env: bool = False,
trust_entrypoints: bool | None = None,
execution_horizon: int = 1,
prefetch_lead: int = 0,
view: ViewArg = None,
workflow_edition: str | None = None,
trial_index_base: int = 0,
)A local model (a Model instance or subclass class) runs on
Model.run()’s native runtime loop – single or vectorized env, batched
predict corners, runtime-enforced seeds/caps; see its docstring for the
parameter surface. A bare predict callable or policy object is refused: wrap
it in the framework Model whose arrays it expects
(rlmesh.numpy.Model(fn)), the library never picks one. prefetch_lead
(> 0) is the native loop’s async inference: the next chunk is predicted
while that many replay frames of the current one remain, from an observation
up to prefetch_lead steps stale, so the result is not comparable to a
synchronous run. A served RemoteModel / SandboxModel (and
the rlmesh.RANDOM_SAMPLE baseline) runs through its own session
loop, which supports every parameter except prefetch_lead. hooks
and instruction work on both; the live viewer (view) is the session
loop’s alone – a local model takes it on Model.session(). A model
instance is borrowed and stays usable afterwards; a model built here from a
subclass class is closed when the call returns.
workflow_edition declares the contract for this call with the same
precedence as rlmesh.session().