# Custom Evaluator Agent-as-Judge Evaluation (/examples/evals/agent-as-judge/agent-as-judge-custom-evaluator)



Demonstrates using a custom evaluator agent for judging.

With a custom evaluator, place the criterion and rubric in that agent’s instructions. The outer `criteria` and `additional_guidelines` are not automatically added to its prompt. The framework supplies the scoring output schema and applies the threshold to the returned score.

```python title="agent_as_judge_custom_evaluator.py"
"""
Custom Evaluator Agent-as-Judge Evaluation
==========================================

Demonstrates using a custom evaluator agent for judging.
"""

from agno.agent import Agent
from agno.eval.agent_as_judge import AgentAsJudgeEval
from agno.models.openai import OpenAIChat

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
agent = Agent(
    model=OpenAIChat(id="gpt-5.6-luna"),
    instructions="Explain technical concepts simply.",
)

# ---------------------------------------------------------------------------
# Create Evaluator Agent
# ---------------------------------------------------------------------------
custom_evaluator = Agent(
    model=OpenAIChat(id="gpt-5.6-luna"),
    description="Strict technical evaluator",
    instructions="You are a strict evaluator. Only give high scores to exceptionally clear and accurate explanations.",
)

# ---------------------------------------------------------------------------
# Create Evaluation
# ---------------------------------------------------------------------------
evaluation = AgentAsJudgeEval(
    name="Technical Accuracy",
    criteria="Explanation must be technically accurate and comprehensive",
    scoring_strategy="numeric",
    threshold=8,
    evaluator_agent=custom_evaluator,
)

# ---------------------------------------------------------------------------
# Run Evaluation
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    response = agent.run("What is machine learning?")
    result = evaluation.run(
        input="What is machine learning?",
        output=str(response.content),
        print_results=True,
    )
    print(f"Score: {result.results[0].score}/10")
    print(f"Passed: {result.results[0].passed}")
```

## Run the Example [#run-the-example]

<Steps>
    <Step title="Set up your virtual environment">
      <CodeBlockTabs defaultValue="Mac">
        <CodeBlockTabsList>
          <CodeBlockTabsTrigger value="Mac">
            Mac
          </CodeBlockTabsTrigger>

          <CodeBlockTabsTrigger value="Windows">
            Windows
          </CodeBlockTabsTrigger>
        </CodeBlockTabsList>

        <CodeBlockTab value="Mac">
          ```bash
          uv venv --python 3.12
          source .venv/bin/activate
          ```
        </CodeBlockTab>

        <CodeBlockTab value="Windows">
          ```bash
          uv venv --python 3.12
          .venv\Scripts\activate
          ```
        </CodeBlockTab>
      </CodeBlockTabs>
    </Step>

  <Step title="Install dependencies">
    ```bash
    uv pip install -U agno openai
    ```
  </Step>

  <Step title="Export your OpenAI API key">
    <CodeBlockTabs defaultValue="Mac/Linux">
      <CodeBlockTabsList>
        <CodeBlockTabsTrigger value="Mac/Linux">
          Mac/Linux
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="Windows">
          Windows
        </CodeBlockTabsTrigger>
      </CodeBlockTabsList>

      <CodeBlockTab value="Mac/Linux">
        ```bash
        export OPENAI_API_KEY="your_openai_api_key_here"
        ```
      </CodeBlockTab>

      <CodeBlockTab value="Windows">
        ```bash
        $Env:OPENAI_API_KEY="your_openai_api_key_here"
        ```
      </CodeBlockTab>
    </CodeBlockTabs>
  </Step>

  <Step title="Give the custom judge its criterion">
    Immediately after creating `custom_evaluator` and before constructing `evaluation`, set:

    ```python title="custom judge instructions"
    custom_evaluator.instructions = [
        "You are a strict technical evaluator.",
        "Explanation must be technically accurate and comprehensive",
        "Only give high scores to exceptionally clear and accurate explanations.",
        "Return an integer score from 1 to 10 and explain the score: "
        "1 is incorrect or irrelevant, 5 is partly correct with material gaps, "
        "8 is accurate and comprehensive, and 10 is exceptionally clear and complete.",
    ]
    ```
  </Step>

  <Step title="Run the example">
    Save the code above as `agent_as_judge_custom_evaluator.py`, then run:

    ```bash
    python agent_as_judge_custom_evaluator.py
    ```
  </Step>
</Steps>

Full source: [cookbook/09\_evals/agent\_as\_judge/agent\_as\_judge\_custom\_evaluator.py](https://github.com/agno-agi/agno/blob/8f36eaf2d18e91afa7b327eec66a3cd3685dcb87/cookbook/09_evals/agent_as_judge/agent_as_judge_custom_evaluator.py)
