# Tutorial 2: Build your first judge

**Time:** \~20 minutes **Level:** Beginner-intermediate **You'll build:** A custom helpfulness judge, tested against examples, applied to an evaluation.

## What you'll learn

* How to author a judge rubric
* How to test a judge against examples
* How to apply a judge to an evaluation
* When to GEPA-optimize (next tutorial)

## Prerequisites

* [ ] Completed [Tutorial 1](/8.-evaluate-score-the-outputs/01-first-evaluation.md)
* [ ] At least 10 example outputs you can label "good" or "bad"

## Step 1: Define the dimension

Write down — in plain English — what you're trying to grade. Keep it specific. "Helpfulness for customer-support questions about billing." Not just "helpful."

## Step 2: Create the judge via SDK

```python
from layerlens import Stratix

client = Stratix()

judge = client.judges.create(
 name="billing-support-helpfulness",
 evaluation_goal="Rate whether the response helps the customer resolve a billing question. The response should: (1) directly address the question, (2) provide actionable next steps, (3) be polite and professional.",
)
print("Judge:", judge.id)
```

## Step 3: Test on examples

```python
sample_input = "I was charged twice this month. What do I do?"
sample_output = "Sorry to hear that. Please email billing@company.com and include the dates of both charges. We'll refund the duplicate within 3-5 business days."

verdict = client.judges.run(
 judge_id=judge.id,
 input=sample_input,
 output=sample_output,
)
print("Verdict:", verdict.score, verdict.reasoning)
```

## Step 4: Iterate the rubric

If the verdict doesn't match your intuition, edit the rubric and re-test.

```python
client.judges.update(
 judge_id=judge.id,
 evaluation_goal="(updated rubric...)",
)
```

## Step 5: Apply to an evaluation

```python
evaluation = client.evaluations.create(
 model=model,
 benchmark=benchmark,
 judges=[judge.id],
)
result = client.evaluations.wait_for_completion(evaluation)
print(f"Helpfulness pass rate: {result.judge_results[judge.id].pass_rate}")
```

## Step 6 (optional): GEPA-optimize

If you have ≥30 labeled examples, jump to [Tutorial 5](/9.-improve-tune-the-system/05-gepa-optimize.md) to lift judge agreement.

## What's next

* [Tutorial 3: CI/CD quality gates](/6.-build-wire-your-code/03-cicd-gates.md)
* [Tutorial 5: GEPA-optimize a judge](/9.-improve-tune-the-system/05-gepa-optimize.md)
* [Concept: Judges](/8.-evaluate-score-the-outputs/judges-1.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.layerlens.ai/8.-evaluate-score-the-outputs/02-first-judge.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
