Skip to content
Judgment Labs
Esc
navigateopen⌘Jpreview
On this page

AgentJudgeFactory

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="Rate the assistant's helpfulness on a scale of 0 to 1.",
    model="gpt-5.2",
    score_type="numeric",
)

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, model, score_type, 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
modelstr

LiteLLM model id (e.g. "gpt-5.2").

Typestr
score_typeScoreType

One of "numeric", "binary", or "categorical".

TypeScoreType
description?Optional[str]

Description stored on the underlying scorer 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.

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

Lower bound for numeric judges (defaults to 0).

TypeOptional[float]
DefaultNone
max_score?Optional[float]

Upper bound for numeric judges (defaults to 1).

TypeOptional[float]
DefaultNone

Returns

typing.Optional - The created AgentJudge, or None if the project is unresolved.


update()

Update an existing Agent Judge.

Passing any of prompt, model, categories, min_score, or max_score writes a new version of the underlying prompt scorer. When target_major_version / target_minor_version are omitted, the server auto-bumps the latest version’s minor by 1 — matching the UI’s default “save” behaviour.

def update(*, judge_id, prompt=None, model=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]

New LiteLLM model id.

TypeOptional[str]
DefaultNone
score_type?Optional[ScoreType]

New score type (numeric, binary, categorical).

TypeOptional[ScoreType]
DefaultNone
description?Optional[str]

New scorer-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.

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.

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.

TypeOptional[int]
DefaultNone

Returns

typing.Optional - The updated AgentJudge, or None if the project is unresolved.

Was this page helpful?