Extending UniLab: New Backend¶
Read Backend Capability Contract and ADR-0002 Backend Capability Boundary For Play And Snapshot before adding backend code.
Current Backend Shape¶
The repository currently recognizes mujoco and motrix in two important
places:
registry.register_env(...)insrc/unilab/base/registry.pycreate_backend(...)insrc/unilab/base/backend/__init__.py
A third backend is therefore an architecture change, not just a new package.
Implementation Checklist¶
Implement a
SimBackendsubclass undersrc/unilab/base/backend/<backend>/.Add backend construction to
create_backend(...).Update registry validation if the new backend should be accepted by
@registry.env(..., sim_backend=...).Expose backend-specific optional capabilities through
SimBackendmethods,BackendPlayCapabilities, domain-randomization capability methods, or a new explicit abstract method.Add task owner YAMLs for supported task/backend pairs. Route user-facing examples through
--task <task> --sim <backend>and do not rely ontraining.sim_backend=<backend>as an override.Keep XML, asset, and model inspection in backend init or materialization code. Hot env paths should receive cached IDs, arrays, or declared backend methods.
Validation Near Risk¶
Backend import and interface tests:
tests/base/test_backend_imports.py,tests/base/test_sim_backend.pyBackend-specific behavior tests near the feature boundary, such as
tests/base/test_motrix_backend_options.pyTask/backend config composition:
tests/config/test_config_system.py
Evidence In Repo¶
Backend interface:
src/unilab/base/backend/base.pyBackend factory:
src/unilab/base/backend/__init__.pyMuJoCo backend package:
src/unilab/base/backend/mujoco/Motrix backend package:
src/unilab/base/backend/motrix/