Skip to main content
Agent Judge evaluates an agent execution after it runs. A Judge receives a JudgmentContext and returns a Judgment whose required status is independent from its optional normalized score and optional label.

Prerequisites

  • Java 21 or newer
  • Maven 3.9 or the Maven Wrapper
  • Credentials only when you choose a live LLM-backed judge
The canonical tutorial modules use deterministic inputs and require no credentials.

Add the dependency

All ten artifacts use the same group and version. The framework bridge dependencies are optional at the application boundary. Your application supplies the framework runtime version it uses.

Build a context and run one judge

This excerpt is compiled as tutorial module 01.
Read result.status() first. result.score() and result.label() may be null because a Boolean decision does not duplicate its outcome as a stored number or category. Use result.effectiveScore() only when an aggregation algorithm deliberately needs a numeric view of PASS or FAIL.

Understand result portability

A result can carry strings, booleans, interoperable integers, finite numbers, arrays, and string-keyed objects in metadata. Agent Judge recursively copies and freezes those values. Live exceptions, SDK responses, Duration objects, enums, and other Java identities do not belong in result metadata. JudgmentContext is an in-process input and may hold framework-native objects needed by a judge. Judgment is the portable output boundary.

Run the tutorial

Clone https://github.com/markpollack/agent-judge-tutorial.git, enter the checkout, run ./mvnw clean test, and then run ./mvnw exec:java -pl module-01-single-judge. The tutorial contains ten modules and progresses through composition, juries, custom judges, model-backed evaluation, Koog, and LangChain4j.

Next

Tutorial

Run every compiled sample

Design Philosophy

Learn the normalized result invariants

Built-in Judges

Choose a judge family

Jury System

Aggregate multiple judgments