Skip to content
Judgment Labs
Esc
↑↓navigate↵open⌘Jpreview
On this page

AgentJudgeFactory

Create and update prompt-based Agent judges on the Judgment platform.

PropType
JudgeVersion?Any
TypeAny
DefaultUnion[Literal['latest', 'production'], GetJudgeRequestVersion]
VersionConfig?Any
TypeAny
DefaultUpdateJudgeRequestUpdateNewVersionConfig
TargetVersion?Any
TypeAny
DefaultUpdateJudgeRequestUpdateNewVersionTargetVersion
BinaryVersion?Any
TypeAny
DefaultUpdateJudgeRequestUpdateNewVersion
NumericVersion?Any
TypeAny
DefaultUpdateJudgeRequestUpdateNewVersion1
CategoricalVersion?Any
TypeAny
DefaultUpdateJudgeRequestUpdateNewVersion2
PromptJudgeVersion?Any
TypeAny
DefaultUnion[BinaryVersion, NumericVersion, CategoricalVersion]
CategoryOutput?Any
TypeAny
DefaultUnion[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

PropType
clientJudgmentSyncClient
TypeJudgmentSyncClient
project_idOptional[str]
TypeOptional[str]
project_namestr
Typestr

create()

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

PropType
namestr

Unique judge name within the project.

Typestr
promptstr

Rubric prompt template used by the Agent judge.

Typestr
score_typeScoreType

"categorical", or "binary" for a categorical judge with Pass / Fail outputs. New judges cannot be "numeric"; existing numeric judges can still be updated.

TypeScoreType
model?Optional[str]

Deprecated and ignored; the platform picks the model from reasoning_level.

TypeOptional[str]
DefaultNone
reasoning_level?Optional[ReasoningLevel]

"lite" (default), "normal", or "high".

TypeOptional[ReasoningLevel]
DefaultNone
description?Optional[str]

Description stored on the initial judge version.

TypeOptional[str]
DefaultNone
judge_description?Optional[str]

Description shown in the UI.

TypeOptional[str]
DefaultNone
categories?Optional[List[Dict[str, Any]]]

Choice list for categorical judges (at least two).

TypeOptional[List[Dict[str, Any]]]
DefaultNone
min_score?Optional[float]

Lower score bound stored on the version.

TypeOptional[float]
DefaultNone
max_score?Optional[float]

Upper score bound stored on the version.

TypeOptional[float]
DefaultNone

Returns

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

PropType
judge_idstr

ID of the judge to update.

Typestr
prompt?Optional[str]

New rubric prompt template.

TypeOptional[str]
DefaultNone
model?Optional[str]

Deprecated and ignored; the platform picks the model from reasoning_level.

TypeOptional[str]
DefaultNone
reasoning_level?Optional[ReasoningLevel]

New reasoning level.

TypeOptional[ReasoningLevel]
DefaultNone
score_type?Optional[ScoreType]

Must match the judge's existing score type.

TypeOptional[ScoreType]
DefaultNone
description?Optional[str]

New judge-version description.

TypeOptional[str]
DefaultNone
judge_description?Optional[str]

New UI-facing description.

TypeOptional[str]
DefaultNone
categories?Optional[List[Dict[str, Any]]]

New choices for categorical judges; names matching an existing choice keep it, and its description must match.

TypeOptional[List[Dict[str, Any]]]
DefaultNone
min_score?Optional[float]

New lower bound for numeric judges.

TypeOptional[float]
DefaultNone
max_score?Optional[float]

New upper bound for numeric judges.

TypeOptional[float]
DefaultNone
source_major_version?Optional[int]

Major version to copy unspecified fields from. Defaults to the latest version.

TypeOptional[int]
DefaultNone
source_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.

TypeOptional[int]
DefaultNone
target_major_version?Optional[int]

Major version to write to. Defaults to the current latest major.

TypeOptional[int]
DefaultNone
target_minor_version?Optional[int]

Minor version to write to. Defaults to latest minor + 1 in the latest major, else 0.

TypeOptional[int]
DefaultNone

Returns

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

PropType
latestGetJudgeResponseJudge
TypeGetJudgeResponseJudge
majorOptional[int]
TypeOptional[int]
minorOptional[int]
TypeOptional[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

PropType
sourceGetJudgeResponseJudge
TypeGetJudgeResponseJudge
promptOptional[str]
TypeOptional[str]
descriptionOptional[str]
TypeOptional[str]
reasoning_levelOptional[ReasoningLevel]
TypeOptional[ReasoningLevel]
min_scoreOptional[float]
TypeOptional[float]
max_scoreOptional[float]
TypeOptional[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

PropType
requestedOptional[ScoreType]
TypeOptional[ScoreType]
sourceGetJudgeResponseJudge
TypeGetJudgeResponseJudge

Returns

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

PropType
sourceGetJudgeResponseJudge
TypeGetJudgeResponseJudge
targetTargetVersion
TypeTargetVersion
score_typeScoreType
TypeScoreType
categoriesOptional[List[Dict[str, Any]]]
TypeOptional[List[Dict[str, Any]]]
configVersionConfig
TypeVersionConfig

Returns

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

PropType
sourceGetJudgeResponseJudge
TypeGetJudgeResponseJudge
categoriesOptional[List[Dict[str, Any]]]
TypeOptional[List[Dict[str, Any]]]

Returns

List[CategoryOutput]


_warn_if_model()

def _warn_if_model(model) -> None:

Parameters

PropType
modelOptional[str]
TypeOptional[str]

Returns

None


_to_agent_judge()

def _to_agent_judge(judge) -> AgentJudge:

Parameters

PropType
judgeGetJudgeResponseJudge
TypeGetJudgeResponseJudge

Returns

AgentJudge

Was this page helpful?