Skip to content

IJobHandler

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

The extension point that provides job execution logic for a specific JobKind.

public interface IJobHandler

Registered with AddJobHandler<T>. AgentPrism.Core provides two implementations (JobKind.AgentBatch, JobKind.Workflow); evaluation adds its own handler (JobKind.Eval) the same way. The background worker picks among the registered handlers by the IJobHandler.Kind field.

The job kind this handler can execute.

JobKind Kind { get; }

JobKind

ExecuteAsync(JobContext, CancellationToken)

Section titled “ ExecuteAsync(JobContext, CancellationToken)”

Executes the job.

ValueTask ExecuteAsync(JobContext context, CancellationToken cancellationToken = default)

context JobContext

The job context: record, items, reporting, and cancellation check.

cancellationToken CancellationToken

The cancellation token (triggered when the worker shuts down).

ValueTask

The completion task.

If the handler throws, the job is retried with IJobStore.ReleaseForRetryAsync (if the attempt limit is not exceeded) or marked as JobStatus.Failed.