Module path
The runtime package isworldflux.runtime (singular). Sources:
The Protocol
doctor returns a list of human-readable diagnostic lines. build_env materialises the venv (or vendor equivalent) for an adapter. run actually launches the command. teardown cleans up.
Context and result
cost_estimate_usd may be filled by remote wrappers for paid-instance experiments. metadata carries free-form key/value pairs that end up in the manifest.
Built-in plugins
local_command.py and modal_command.py are recipe-level external command
runtimes, not dispatcher plugins. They load an external manifest, build a
minimal environment, and require explicit provider env allowlists before secrets
can be forwarded.
The dispatcher registers them at import time:
get_runtime("aws-ec2") returns the singleton. list_runtimes() returns the sorted name list. doctor_all() runs every plugin’s doctor() and returns a dict[str, list[str]].
Runtime CLI
Theruntime sub-tree exposes the dispatcher to the CLI:
worldflux runtime list prints registered plugin names. worldflux runtime doctor runs every plugin’s doctor() and prints the result. The same diagnostics also surface in worldflux doctor.
Writing a plugin
1
Drop the file
Create
src/worldflux/runtime/<name>_plugin.py. Define a class with the four Protocol methods and a name: str class attribute.2
Register it
In
src/worldflux/runtime/dispatcher.py, import the class and call _register(MyPlugin()) at module bottom.3
Add a doctor probe
doctor() returns one line per check. Lines starting with error: block runs; everything else is informational. Common checks: binary on $PATH, env vars set, GPU visible, vendor SDK importable.4
Implement run()
Use
RuntimeContext.venv_python (or the equivalent runtime entrypoint) to launch the command. Capture stdout/stderr to RuntimeContext.output_dir / "logs" / f"{run_id}.log" and pass that path back as RuntimeResult.log_path.5
Tests
Add
tests/runtime/test_<name>_plugin.py. Reuse provider fakes rather than mocking ad hoc.What lands in the manifest
Anything the plugin writes viaRuntimeResult.metadata becomes a leaf under manifest.runtime. The recipe-level metrics live under manifest.metrics. Logs are referenced by path (the manifest carries the path, the bytes ride the artifact channel).