Verdict¶
verdict
¶
Verdict JSON schema validation and loading.
Provides a generic framework for loading and validating structured verdict files produced by AI agent runs. Callers define their own schemas (required fields, allowed verdict values) and this module handles file I/O, JSON parsing, and schema validation.
VerdictError
¶
Bases: Exception
Raised when a verdict file is missing, malformed, or invalid.
load_verdict(path, *, required_fields, allowed_verdicts, name='verdict')
¶
Load and validate a verdict JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to the verdict JSON file. |
required |
required_fields
|
set[str]
|
Set of field names that must be present. |
required |
allowed_verdicts
|
frozenset[str]
|
Set of allowed values for the |
required |
name
|
str
|
Human-readable name for error messages. |
'verdict'
|
Returns:
| Type | Description |
|---|---|
dict
|
The parsed verdict dict. |
Raises:
| Type | Description |
|---|---|
VerdictError
|
If the file is missing, malformed, or schema-invalid. |