Interface EvaluatorClient


@DoNotInherit public interface EvaluatorClient
Client for starting evaluations on request with an Evaluator or DurableEvaluator, outside automatic agent bindings.

Typically called from the final step of a workflow to evaluate the outcome of an entire run, or from an endpoint to evaluate a recorded interaction again.

The evaluation ID is deterministically derived from the evaluator, the subject, and the attributes. Repeated calls with identical arguments return the same evaluation ID. The runtime delivers the trigger at least once:

  • For an Evaluator, each repeated call triggers another evaluation and records each run under that ID. Retried workflow steps may therefore run the evaluator multiple times.
  • For a DurableEvaluator, the evaluation runs only once per ID while the instance exists. Subsequent calls return the existing ID without re-executing.
To evaluate the same subject again intentionally (for instance, after updating a prompt), pass distinct attributes, such as a prompt version.

Not for user extension; implementation is provided by the SDK.

  • Method Details

    • startEvaluation

      default String startEvaluation(Subject subject, Map<String,String> attributes)
      Starts an evaluation of the given subject.

      The evaluation runs asynchronously in the background and can start before the workflow step that calls this method is persisted. Persist the result to evaluate in an earlier step. The outcome is recorded in the ledger under the returned evaluation ID; see LedgerClient.getEvaluation(String).

      Blocks the calling thread until the evaluation is durably queued. Safe to call on a virtual thread. Use startEvaluationAsync(Subject, Map) for non-blocking execution.

      Parameters:
      subject - what to evaluate; must not be null
      attributes - contextual metadata passed to EvaluationContext.attributes(), such as interaction IDs to judge; recorded with the evaluation; must not be null
      Returns:
      the generated evaluation ID
      Throws:
      NullPointerException - if subject or attributes is null
      IllegalArgumentException - if no evaluator matches this client component ID, if the subject has an empty ID or component ID, if either is longer than 256 characters or holds a null character, if an attribute key is empty, or if total attribute keys and values exceed 8192 characters
      IllegalStateException - if evaluators or the ledger are disabled, or if this evaluator has enabled = false in its configuration
    • startEvaluationAsync

      CompletionStage<String> startEvaluationAsync(Subject subject, Map<String,String> attributes)
      Asynchronously starts an evaluation of the given subject.
      Parameters:
      subject - what to evaluate; must not be null
      attributes - contextual metadata passed to the evaluator; must not be null
      Returns:
      a completion stage that completes with the evaluation ID once durably queued, or fails with the exceptions documented in startEvaluation(Subject, Map)