Interface EvaluatorClient
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.
Not for user extension; implementation is provided by the SDK.
-
Method Summary
-
Method Details
-
startEvaluation
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 nullattributes- contextual metadata passed toEvaluationContext.attributes(), such as interaction IDs to judge; recorded with the evaluation; must not be null- Returns:
- the generated evaluation ID
- Throws:
NullPointerException- ifsubjectorattributesis nullIllegalArgumentException- 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 charactersIllegalStateException- if evaluators or the ledger are disabled, or if this evaluator hasenabled = falsein its configuration
-
startEvaluationAsync
Asynchronously starts an evaluation of the given subject.- Parameters:
subject- what to evaluate; must not be nullattributes- 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)
-