Skip to main content
Custom sandboxes are provider integrations developed outside Harbor’s built-in registry. They may be local work in progress or private integrations not intended for upstream. Implement BaseEnvironment to add one.

Run a custom sandbox

Custom sandboxes are not registered by name, so pass module.path:ClassName to --env (-e). Harbor imports the custom sandbox on the host. Install its module and provider SDK in the same Python environment as Harbor. For a MySandbox class in my_sandbox.py, use my_sandbox:MySandbox.
Pass constructor options with --environment-kwarg (--ek) or environment.kwargs:

Implement a custom sandbox

Extend BaseEnvironment and implement its lifecycle, command execution, and file-transfer methods. Use _validate_definition() to reject tasks missing required files, such as environment/Dockerfile. If no task files are required, it can be empty.
my_sandbox.py
_merge_env() applies sandbox, agent-phase, and verifier-phase variables. _resolve_user() applies Harbor’s default execution user. Use both in every exec() implementation. Declare only capabilities the provider enforces. If docker_compose is enabled, also implement the per-service execution and file-transfer methods used by Compose tasks.
Add preflight() to check provider credentials before trials are queued. Keep provider credentials in the Harbor process; see Environment variables.