awrena
Run one judged head-to-head between two agents and read the scored verdict.
pip install awrena
from awrena import Judge
judge = Judge()
verdict = judge.judge(
a_response="Agent A's output",
b_response="Agent B's output",
question="What was the question?"
)
if verdict.is_valid():
print(f"Winner: {verdict.winner}")
print(f"Scores: {verdict.a_score:.1f} vs {verdict.b_score:.1f}")
print(f"Reason: {verdict.reason}")
# Prepare a JSON file with agent responses
cat > responses.json << 'EOF'
{
"question": "What is the capital of France?",
"a_response": "Paris",
"b_response": "The capital of France is Paris, the largest city in the country and home to the Louvre, Notre-Dame Cathedral, and many other historical landmarks."
}
EOF
# Judge the responses
awrena judge responses.json
# Output: B wins (28.6 vs 71.4): length: B is longer (20 vs 1 words)
# Get JSON output for programmatic use
awrena judge responses.json --format json
The brick
A judge compares two agent outputs and assigns scores. Every judgment path succeeds with a clear verdict — empty responses are handled, errors don't raise, and the scoring is deterministic and explainable.
Scoring criteria
Choose how to judge responses:
| criteria | measures |
|---|---|
--criteria default |
response length (default) |
--criteria length |
raw character count |
--criteria content |
word count, ignoring whitespace |
Extend with custom criteria:
from awrena import Criteria
class ExactnessCriterion(Criteria):
def _evaluate(self, a_response, b_response):
# Return (a_score, b_score, reason)
# Scores are 0-100; reason explains the judgment
return 75.0, 60.0, "A is more precise"
judge = Judge([ExactnessCriterion("exactness")])
verdict = judge.judge(a, b)
Always returns a verdict
A judge that breaks silently is worse than one that names its failure. Every path
returns a complete Verdict:
verdict = judge.judge(a, b)
if verdict.is_valid():
print(verdict.summary()) # "A wins (80.0 vs 20.0): ..."
else:
print(f"Error: {verdict.error}") # "Error: judge error: ..."
Empty responses, exceptions during scoring, missing criteria — all return clear, complete verdicts with explanations.
Verdict structure
@dataclass
class Verdict:
winner: str # "a", "b", or "tie"
a_score: float # 0-100
b_score: float # 0-100
reason: str # explanation of the judgment
error: Optional[str] # None if judgment succeeded
Tests
All paths tested in both directions: a suite that only checks wins passes on a judge that always selects A, and one that only checks for ties passes on a judge that always ties. The test suite includes:
- Happy path: both agents respond, verdict is computed
- Error paths: empty responses, malformed criteria, exceptions
- Boundary cases: identical responses, extreme length differences
- A test that fails if the judge were replaced by one that always ties
pip install -e ".[dev]" && pytest
Where it sits
| package | question |
|---|---|
awrena |
which agent performed better? |
Run a head-to-head comparison, get a scored, reasoned verdict. Extend the scoring logic with your own criteria. Integrate with agent orchestration to select winners.
Apache-2.0.
The aw family
Standalone tools that share one idea: replace something you would otherwise have to trust with something you can check.
Each installs on its own, works offline, and needs no account.
See awkno for the full Aither World ecosystem.
Metadata
Release files for awrena 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| awrena-0.1.0.tar.gz | 17.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| awrena-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.4 kB
Release files / awrena-0.1.0.tar.gz
| Download URL | awrena-0.1.0.tar.gz |
|---|---|
| Size | 17.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4bb57b6258c788caea02bc1d7ebd2fdd71f33d181c6123cedd5ffff576046f81
|
|
BLAKE2b-256 checksum How to use checksums |
7f853d273d7666a088474c01f93bf2130a5c2621bef54d74c607d2f58f9bd535
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / awrena-0.1.0-py3-none-any.whl
| Download URL | awrena-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83f5a05980b25f004b4d3385dfc68415c928ee1d23999bc3e3f2a470b9dd3f91
|
|
BLAKE2b-256 checksum How to use checksums |
5f4224d9a30ab0678c36a4185969d459de789ab40cd7befb8da3c7ed42dedfdb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for awrena 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.