# Tool-Using Agent-as-Judge Evaluation (/examples/evals/agent-as-judge/agent-as-judge-with-tools)



Demonstrates judging responses generated by an agent using tools.

```python title="agent_as_judge_with_tools.py"
"""
Tool-Using Agent-as-Judge Evaluation
====================================

Demonstrates judging responses generated by an agent using tools.
"""

from typing import Optional

from agno.agent import Agent
from agno.eval.agent_as_judge import AgentAsJudgeEval, AgentAsJudgeResult
from agno.models.openai import OpenAIChat
from agno.tools.calculator import CalculatorTools

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
agent = Agent(
    model=OpenAIChat(id="gpt-5.6-luna"),
    tools=[CalculatorTools()],
    instructions="Use the calculator tools to solve math problems. Explain your reasoning and show calculation steps clearly.",
)

# ---------------------------------------------------------------------------
# Create Evaluation
# ---------------------------------------------------------------------------
evaluation = AgentAsJudgeEval(
    name="Calculator Tool Usage Quality",
    model=OpenAIChat(id="gpt-5.2"),
    criteria="Response should clearly explain the calculation process, show intermediate steps, and present the final answer in a user-friendly way",
    scoring_strategy="numeric",
    threshold=7,
)

# ---------------------------------------------------------------------------
# Run Evaluation
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    response = agent.run("What is 15 * 23 + 47?")
    result: Optional[AgentAsJudgeResult] = evaluation.run(
        input="What is 15 * 23 + 47?",
        output=str(response.content),
        print_results=True,
    )
    assert result is not None, "Evaluation should return a result"
```

## 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="Run the example">
    Save the code above as `agent_as_judge_with_tools.py`, then run:

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

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