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
name | Module | When |
|---|---|---|
local | local_plugin.LocalPlugin | Anything you can run on the local box. |
modal | modal_plugin.ModalPlugin | Experimental wrapper; curated production runs stay disabled unless adapter metadata is production-backed. |
aws-ec2 | aws_ec2_plugin.AwsEc2Plugin | Experimental wrapper with cost guards; curated production runs stay disabled unless adapter metadata is production-backed. |
replicate | replicate_plugin.ReplicatePlugin | Vendor wrapper; production share/run claims require live smoke evidence and adapter support metadata. |
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
Drop the file
Create
src/worldflux/runtime/<name>_plugin.py. Define a class with the four Protocol methods and a name: str class attribute.Register it
In
src/worldflux/runtime/dispatcher.py, import the class and call _register(MyPlugin()) at module bottom.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.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.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).