feat: add Runner, RunnerResult, Judge, and Evaluator#180
Conversation
…b.com:launchdarkly/java-core into mmccarthy/AIC-2665/java-ai-sdk-v-1-0-aievals
…b.com:launchdarkly/java-core into mmccarthy/AIC-2665/java-ai-sdk-v-1-0-aievals
…b.com:launchdarkly/java-core into mmccarthy/AIC-2665/java-ai-sdk-v-1-0-aievals
…b.com:launchdarkly/java-core into mmccarthy/AIC-2665/java-ai-sdk-v-1-0-aievals
Co-authored-by: Cursor <cursoragent@cursor.com>
…hy/AIC-2665/java-ai-sdk-v-1-0-aievals
…Key from escaping
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 792d33c. Configure here.
| .success(false) | ||
| .errorMessage(ex.getMessage()) | ||
| .build(); | ||
| } |
There was a problem hiding this comment.
Exception path omits judge identity
Medium Severity
When Judge.evaluate catches a runner or tracker failure, the returned JudgeResult sets sampled, success, and errorMessage but not judgeConfigKey or metricKey. Other sampled failure paths populate those fields. Callers and Evaluator runs that handle multiple judges cannot reliably tell which judge failed except by list index.
Reviewed by Cursor Bugbot for commit 792d33c. Configure here.


Summary
Adds the AIEVALS types —
Runner,RunnerResult,Judge, andEvaluator— and wiresEvaluator.noop()into all config types. Callers can now implement aRunnerto wrap any model provider, construct aJudgeto evaluate AI outputs against a judge prompt with structured{score, reasoning}output, and coordinate multiple judges through anEvaluator.New types
Wraps a model provider SDK.
outputTypecarries a JSON-Schema-like map when structured output is needed. Single-arg overload delegates withoutputType = null.Immutable result of a
Runnerinvocation.parsedis defensively copied and returned as unmodifiable.Evaluates AI output by invoking a runner with a formatted evaluation prompt and parsing the structured response. Sampling gate runs first — below the rate, returns
sampled=falseimmediately. Creates a fresh tracker per evaluation viaconfig.createTracker(). Parsesscore(Number, [0.0, 1.0]) andreasoning(String, optional). Runner exceptions are caught and returned asJudgeResult(success=false)— judge failures are results, not exceptions. Does not calltrackJudgeResult.Coordinates sequential execution of judges. Missing judges skipped with a warning.
Evaluator.noop()returns a singleton whoseevaluateimmediately returns an empty list. For v1.0, all configs receiveEvaluator.noop().Config type changes
AIConfigbase class gains anEvaluatorfield andgetEvaluator()accessor.AICompletionConfigandAIAgentConfigconstructors accept anEvaluator.AIJudgeConfigalways wiresEvaluator.noop()internally — judges do not evaluate themselves.Test plan
./gradlew :lib:sdk:server-ai:testpassesJudgeTest— successful evaluation, score boundary validation (0 and 1), reasoning optional, runner exception handling (caught not rethrown), null/missing parsed output, score out of range, sampling rates (0 always skips, 1 always runs), message formatting, getter accessorsEvaluatorTest— noop returns empty list, noop singleton identity, single/multiple judge execution, missing judge skipped, evaluator does not calltrackJudgeResult, returned future is already completeRunnerResultTest— builder field assignment, immutability, defensive copy of parsed mapNote
Medium Risk
New public SDK types and constructor changes on internal config builders; runtime judge paths invoke user-supplied Runners and affect metrics tracking, though client retrieval still uses noop evaluators.
Overview
Adds AI evaluation plumbing to
server-ai: aRunnerabstraction for provider calls, immutableRunnerResult,Judgefor scored{score, reasoning}evals via structured output, andEvaluatorto run configured judges sequentially (with sampling and skip-on-missing).Config surface:
AIConfignow carries anEvaluatorand exposesgetEvaluator(). Completion and agent configs take an evaluator at construction;LDAIClientImplalways passesEvaluator.noop()for v1.0. Judge configs hard-wire noop internally.Behavior notes:
Judgeapplies sampling before calling the runner, validates parsed scores in[0, 1], wraps runner work intrackMetricsOf, and returns failures asJudgeResultrather than throwing.Evaluatordoes not calltrackJudgeResult—callers own tracking.Reviewed by Cursor Bugbot for commit 792d33c. Bugbot is set up for automated code reviews on this repo. Configure here.