AgentJudgeFactory
Create and update prompt-based Agent judges on the Judgment platform.
JudgeVersion?Any
AnyUnion[Literal['latest', 'production'], GetJudgeRequestVersion]VersionConfig?Any
AnyUpdateJudgeRequestUpdateNewVersionConfigTargetVersion?Any
AnyUpdateJudgeRequestUpdateNewVersionTargetVersionBinaryVersion?Any
AnyUpdateJudgeRequestUpdateNewVersionNumericVersion?Any
AnyUpdateJudgeRequestUpdateNewVersion1CategoricalVersion?Any
AnyUpdateJudgeRequestUpdateNewVersion2PromptJudgeVersion?Any
AnyUnion[BinaryVersion, NumericVersion, CategoricalVersion]CategoryOutput?Any
AnyUnion[UpdateJudgeRequestUpdateNewVersion2Outputs, UpdateJudgeRequestUpdateNewVersion2Outputs1]Create and update prompt-based Agent judges on the Judgment platform.
Access this via client.agent_judges — you don’t instantiate it directly.
client = Judgeval(project_name="my-project")
judge = client.agent_judges.create(
name="helpfulness",
prompt="Did the assistant answer the user's question?",
score_type="binary",
)
client.agent_judges.update(
judge_id=judge.judge_id,
prompt="Updated rubric prompt.",
)
__init__()
def __init__(client, project_id, project_name):
Parameters
clientJudgmentSyncClient
JudgmentSyncClientproject_idOptional[str]
Optional[str]project_namestr
strcreate()
Create a new Agent judge.
def create(*, name, prompt, score_type, model=None, reasoning_level=None, description=None, judge_description=None, categories=None, min_score=None, max_score=None) -> typing.Optional:
Parameters
namestr
Unique judge name within the project.
strpromptstr
Rubric prompt template used by the Agent judge.
strscore_typeScoreType
"categorical", or "binary" for a categorical judge with Pass / Fail outputs. New judges cannot be "numeric"; existing numeric judges can still be updated.
ScoreTypemodel?Optional[str]
Deprecated and ignored; the platform picks the model from reasoning_level.
Optional[str]Nonereasoning_level?Optional[ReasoningLevel]
"lite" (default), "normal", or "high".
Optional[ReasoningLevel]Nonedescription?Optional[str]
Description stored on the initial judge version.
Optional[str]Nonejudge_description?Optional[str]
Description shown in the UI.
Optional[str]Nonecategories?Optional[List[Dict[str, Any]]]
Choice list for categorical judges (at least two).
Optional[List[Dict[str, Any]]]Nonemin_score?Optional[float]
Lower score bound stored on the version.
Optional[float]Nonemax_score?Optional[float]
Upper score bound stored on the version.
Optional[float]NoneReturns
typing.Optional - The created AgentJudge, or None if the project is unresolved.
update()
Update an existing Agent judge.
Passing any version field (prompt, reasoning_level, score_type,
description, categories, min_score, max_score, or a
source/target version) writes a new production version, copying
unspecified fields from the source version. When
target_major_version / target_minor_version are omitted, the
latest version’s minor is bumped by 1 — matching the UI’s default
“save” behaviour. The score type of a judge cannot change.
def update(*, judge_id, prompt=None, model=None, reasoning_level=None, score_type=None, description=None, judge_description=None, categories=None, min_score=None, max_score=None, source_major_version=None, source_minor_version=None, target_major_version=None, target_minor_version=None) -> typing.Optional:
Parameters
judge_idstr
ID of the judge to update.
strprompt?Optional[str]
New rubric prompt template.
Optional[str]Nonemodel?Optional[str]
Deprecated and ignored; the platform picks the model from reasoning_level.
Optional[str]Nonereasoning_level?Optional[ReasoningLevel]
New reasoning level.
Optional[ReasoningLevel]Nonescore_type?Optional[ScoreType]
Must match the judge's existing score type.
Optional[ScoreType]Nonedescription?Optional[str]
New judge-version description.
Optional[str]Nonejudge_description?Optional[str]
New UI-facing description.
Optional[str]Nonecategories?Optional[List[Dict[str, Any]]]
New choices for categorical judges; names matching an existing choice keep it, and its description must match.
Optional[List[Dict[str, Any]]]Nonemin_score?Optional[float]
New lower bound for numeric judges.
Optional[float]Nonemax_score?Optional[float]
New upper bound for numeric judges.
Optional[float]Nonesource_major_version?Optional[int]
Major version to copy unspecified fields from. Defaults to the latest version.
Optional[int]Nonesource_minor_version?Optional[int]
Minor version to copy unspecified fields from. Defaults to the latest version; required when source_major_version is an older major.
Optional[int]Nonetarget_major_version?Optional[int]
Major version to write to. Defaults to the current latest major.
Optional[int]Nonetarget_minor_version?Optional[int]
Minor version to write to. Defaults to latest minor + 1 in the latest major, else 0.
Optional[int]NoneReturns
typing.Optional - The updated AgentJudge, or None if the project is unresolved.
_resolve_target_version()
The version to write: latest minor + 1 in the latest major by default.
def _resolve_target_version(latest, major, minor) -> TargetVersion:
Parameters
latestGetJudgeResponseJudge
GetJudgeResponseJudgemajorOptional[int]
Optional[int]minorOptional[int]
Optional[int]Returns
TargetVersion
_build_version_config()
The requested rubric fields, the rest copied from source.
def _build_version_config(source, *, prompt, description, reasoning_level, min_score, max_score) -> VersionConfig:
Parameters
sourceGetJudgeResponseJudge
GetJudgeResponseJudgepromptOptional[str]
Optional[str]descriptionOptional[str]
Optional[str]reasoning_levelOptional[ReasoningLevel]
Optional[ReasoningLevel]min_scoreOptional[float]
Optional[float]max_scoreOptional[float]
Optional[float]Returns
VersionConfig
_resolve_score_type()
The judge’s own score type; binary also names create()’s Pass/Fail
categorical judges.
def _resolve_score_type(requested, source) -> ScoreType:
Parameters
requestedOptional[ScoreType]
Optional[ScoreType]sourceGetJudgeResponseJudge
GetJudgeResponseJudgeReturns
ScoreType
_build_prompt_version()
A complete new version; monitoring settings and action groups come from
source.
def _build_prompt_version(source, target, score_type, categories, config) -> PromptJudgeVersion:
Parameters
sourceGetJudgeResponseJudge
GetJudgeResponseJudgetargetTargetVersion
TargetVersionscore_typeScoreType
ScoreTypecategoriesOptional[List[Dict[str, Any]]]
Optional[List[Dict[str, Any]]]configVersionConfig
VersionConfigReturns
PromptJudgeVersion
_build_category_outputs()
Existing outputs by ID (all of them when categories is None), new
names by name and description.
def _build_category_outputs(source, categories) -> List[CategoryOutput]:
Parameters
sourceGetJudgeResponseJudge
GetJudgeResponseJudgecategoriesOptional[List[Dict[str, Any]]]
Optional[List[Dict[str, Any]]]Returns
List[CategoryOutput]
_warn_if_model()
def _warn_if_model(model) -> None:
Parameters
modelOptional[str]
Optional[str]Returns
None
_to_agent_judge()
def _to_agent_judge(judge) -> AgentJudge:
Parameters
judgeGetJudgeResponseJudge
GetJudgeResponseJudgeReturns
AgentJudge