Score a run

Ask, then mark

Pass an agent and the question. The judge runs the agent, then scores what it returned.

input is the question. expected is the answer you want.

Example

from praisonai import Agent
from praisonai.eval import Judge

agent = Agent(instructions='State the HTTP status code for Too Many Requests as a 3-digit number only.', output='silent')
result = Judge().run(
    agent=agent,
    input='What HTTP status code means Too Many Requests?',
    expected='429',
)
print('Score :', result.score)
print('Passed:', result.passed)

Try it Yourself

Example explained

  • Judge().run(agent=…, input=…, expected=…) — Executes the live agent on an engineering prompt and grades its reply against the expected answer.

Strict expected

Tighten expected so sloppy answers fail — same as eval in observability courses.

Example

from praisonai import Agent
from praisonai.eval import Judge

agent = Agent(instructions="Answer with one digit only.")
result = Judge().run(agent=agent, input="What is 2+2?", expected="4 only")
print("Passed:", result.passed)

Try it Yourself

Example explained

  • from praisonai import Agent — Imports Agent needed for strict expected.
  • from praisonai.eval import Judge — Imports Judge needed for strict expected.
  • Agent(…) — Instantiates the Agent configured for strict expected.
  • Judge(…) — Scores an agent reply against explicit quality criteria.

Reference: documentation