Score an agent

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. The agent is who produces the output.

Example

from praisonai import Agent, Judge

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

Try it Yourself

Example explained

  • agent — The agent the judge will run.
  • input — The question sent to that agent.

Reference: documentation