The execution package is intentionally modular. Follow these guidelines when adding new capabilities or backends.
- Subclass
EnvironmentSpecwith backend-specific fields. Give the model a distincttypeliteral so Pydantic can discriminate the union. - Implement a
SubmissionRuntimesubclass that fulfils the runtime protocol (stream,execute,poll,kill,cleanup, and thespawnclassmethod). - Decorate the runtime with
@register_runtime("<type>")so the session layer can dispatch to it. - Update
EnvironmentSpecTypeinexecution/__init__.pyto include the new spec. - Document any assumptions about setup commands, mounts, or networking.
Sessions act as the glue between specs, workspaces, and runtimes. When adding new behaviour make sure:
Session.spawn()can forward any additional keyword arguments your runtime requires.- Workspace interactions (
materialize_input_files,get_file_contents,update_snapshot) still behave predictably for both evaluation and agent inference modes. - Static asset placeholder resolution continues to work across backends.
- Extend
StaticAssetConfigif you need new metadata (archives, signed URLs, secrets). - Update the workspace materialization logic or Docker volume wiring to honour the new fields.
- Document how placeholders should be interpreted for the added asset types.
Raise ExecutionError (or a subclass) for user-facing failures such as missing
dependencies, container startup issues, or invalid configuration. Runtimes can
also raise SolutionRuntimeError for recoverable process lifecycle problems.
Keeping errors within the execution namespace helps adapters surface clear
messages and simplifies logging.
- Add unit tests under
tests/execution/for both specs and runtime behaviour. - Consider integration tests that drive a
Sessionend-to-end with an evaluation adapter to catch wiring regressions. - Update
docs/executionand any adapter-specific docs when behaviour changes (volume mounts, networking defaults, snapshot policies, etc.).
Following these patterns keeps the execution layer predictable for adapters and future maintainers.