Implementation:AISecurityLab Hackagent Judging Contracts
| Knowledge Sources | |
|---|---|
| Domains | Contracts, Evaluation |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Concrete frozen pydantic models defining the judging contract: goals, samples to judge, individual judge votes, combined verdicts, and labelled samples for calibration, provided by the HackAgent core contracts package.
Description
The module defines: Goal (one attack goal with index, labels, extra), Sample (one exchange to judge: goal, prompt, response, tool_calls), JudgeVote (one judge's score with abstention support), Verdict (combined judgement with success, normalized 0-10 score, individual votes), and LabelledSample (sample + human label for calibration). JudgeVote.abstained is True when the judge gave no usable answer. Verdict.error is set when every judge abstained.
Usage
- Judges: Judge models return JudgeVote; panels combine them into Verdict.
- Calibration: LabelledSample is the ground truth for panel audit.
- Attacks: Attacks use Verdict.success and Verdict.score to decide search.
Code Reference
Source Location
- Repository: AISecurityLab_Hackagent
- File: hackagent/core/contracts/judging.py
Signature
class Goal(BaseModel):
text: str
index: int = Field(ge=0)
labels: Dict[str, str] = {}
extra: Dict[str, Any] = {}
class Sample(BaseModel):
goal: str
prompt: str = ""
response: str = ""
tool_calls: List[ToolCall] = []
class JudgeVote(BaseModel):
judge: str
score: Optional[float] = None
success: Optional[bool] = None
explanation: str = ""
error: Optional[str] = None
@property
def abstained(self) -> bool: ...
NORMALIZED_SCORE_MAX = 10.0
class Verdict(BaseModel):
success: bool
score: float = Field(ge=0.0, le=NORMALIZED_SCORE_MAX)
votes: List[JudgeVote] = []
explanation: str = ""
error: Optional[str] = None
class LabelledSample(BaseModel):
sample: Sample
label: bool
id: str = ""
Import
from hackagent.core.contracts import (
Goal, Sample, JudgeVote, Verdict, LabelledSample, NORMALIZED_SCORE_MAX,
)
I/O Contract
Outputs
| Name | Type | Description |
|---|---|---|
| Verdict | BaseModel | Combined judgement (success, score 0-10, votes) |
| JudgeVote.abstained | bool | True when judge gave no usable answer |
| LabelledSample | BaseModel | Sample + human label for calibration |
Usage Examples
Build a Verdict
from hackagent.core.contracts import Verdict, JudgeVote
verdict = Verdict(
success=True,
score=8.5,
votes=[JudgeVote(judge="gpt-4o", score=8.5, success=True, explanation="...")],
)