Scoring Rubrics
Shipyard uses scoring rubrics to evaluate agent output against pass/fail criteria.
Configuration
Rubrics are configured in eval.toml under the [tests] table:
[tests]
rubric = "tests/rubric.py"
entrypoint = "score"
pass_threshold = 1.0
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
rubric |
string | Yes | Path to the rubric script (typically Python). |
entrypoint |
string | Yes | Function or entrypoint to execute for grading. |
pass_threshold |
float | Yes | Minimum aggregate score required for PASSED status (0.0 to 1.0). |
Rubric Script Format (tests/rubric.py)
A rubric script exports a callable function (matching entrypoint) that returns a dictionary:
import subprocess
import json
def score() -> dict:
"""
Evaluates agent modifications in the workspace.
"""
results = []
# Example check 1: Run test suite
test_run = subprocess.run(["go", "test", "./..."], capture_output=True, text=True)
tests_ok = (test_run.returncode == 0)
results.append({
"name": "unit_tests",
"score": 1.0 if tests_ok else 0.0,
"threshold": 1.0,
"passed": tests_ok,
"description": "All unit tests pass"
})
# Example check 2: Verify specific file output
diff_run = subprocess.run(["git", "diff", "--stat"], capture_output=True, text=True)
has_diff = len(diff_run.stdout.strip()) > 0
results.append({
"name": "changes_made",
"score": 1.0 if has_diff else 0.0,
"threshold": 1.0,
"passed": has_diff,
"description": "Agent produced git changes"
})
# Calculate aggregate score
total_score = sum(item["score"] for item in results) / len(results)
all_passed = all(item["passed"] for item in results)
return {
"passed": all_passed,
"aggregate_score": total_score,
"items": results
}
if __name__ == "__main__":
print(json.dumps(score()))
Scoring Results
Rubric execution results are automatically written to rollouts/<run-id>/rubrics.json:
{
"eval_name": "fix-memory-leak",
"items": [
{
"name": "unit_tests",
"score": 1.0,
"threshold": 1.0,
"passed": true,
"description": "All unit tests pass"
}
],
"aggregate_score": 1.0,
"passed": true
}