Skip to main content
Harbor uses the plugin interface internally for Harbor Hub. Its upload plugin streams completed trials and finalizes jobs. Custom plugins use the same interface for local or private integrations. They run in the Harbor process, react to job and trial events, and are passed at runtime instead of stored in config.json.

Lifecycle

Available trial callbacks include on_trial_started, on_environment_started, on_agent_started, on_agent_ended, on_verification_started, on_trial_ended, and on_trial_cancelled.

Implement a plugin

Extend BaseJobPlugin and implement its two lifecycle methods. Register trial callbacks from on_job_start when the plugin needs per-trial events.
trial_logger.py
Plugins run outside the sandbox. Install the plugin and its dependencies in the same Python environment as Harbor. See Environment variables for the difference between Harbor-process and sandbox variables.

Run a custom plugin

Custom plugins do not need a registered name. Pass module.path:ClassName to --plugin. For TrialLoggerPlugin in trial_logger.py, use trial_logger:TrialLoggerPlugin.
--plugin-kwarg (--pk) passes constructor options to the plugin. Both --plugin and --pk are repeatable. See Use multiple plugins for the multi-plugin syntax.

Examples

See Harbor’s plugin packages for more implementations. For a third-party integration guide, see Braintrust.