Overview
TheJob class is the single entrypoint for launching a set of trials in Harbor. It handles database initialization, task and dataset management, and saves job-level results to the database and filesystem.
Import: from harbor import Job
Constructor
JobConfig
required
The job configuration object that defines all aspects of the evaluation run.
Properties
After initialization, the Job instance has these key attributes:config: JobConfig- The job configurationis_resuming: bool- Whether this job is resuming from a previous runjob_dir: Path- Directory where job results are stored
Methods
run
JobResult
Contains comprehensive results including:
- Trial results for all executions
- Aggregate statistics across agents and datasets
- Timing information
- Computed metrics
Lifecycle Hooks
Register callbacks for various trial lifecycle events. All hooks returnself for method chaining.
on_trial_started
Callable[[TrialHookEvent], Awaitable[None]]
required
Async function called when a trial begins execution.
on_environment_started
Callable[[TrialHookEvent], Awaitable[None]]
required
Async function called when a trial’s environment is ready.
on_agent_started
Callable[[TrialHookEvent], Awaitable[None]]
required
Async function called when an agent begins execution.
on_verification_started
Callable[[TrialHookEvent], Awaitable[None]]
required
Async function called when verification begins.
on_trial_ended
Callable[[TrialHookEvent], Awaitable[None]]
required
Async function called when a trial ends (success or failure). The
TrialHookEvent.result field will contain the TrialResult.on_trial_cancelled
Callable[[TrialHookEvent], Awaitable[None]]
required
Async function called when a trial is cancelled.
Complete Example
Related Types
- JobConfig - Configuration for the Job
- JobResult - Results returned from job execution
- TrialConfig - Configuration for individual trials
- TrialResult - Results from individual trial execution