steward¶
The independent checker: fixed policies, then a model audit.
coalitionkit_steward ¶
The Steward: policies, model audit and signed verdicts.
StewardContext
dataclass
¶
Facts the host knows and the message does not carry.
Subject
dataclass
¶
What the Steward looks at: an envelope, or an artifact minted from events.
Artifact ¶
Bases: BaseModel
Something minted from events that the Steward must audit before it is shown.
ModelVerdict ¶
Bases: BaseModel
The strict schema of the model's answer.
Steward ¶
audit_reason ¶
Host-only review detail; never include this value in a delivery or error.
review
async
¶
review(
envelope: Envelope,
*,
context: StewardContext | None = None,
flagged: bool = False,
revision: int = 1,
) -> SignedVerdict
Judge one message. The verdict binds the envelope's event_id and revision.
review_artifact
async
¶
Judge a minted artifact. Always audited by the model.
PolicyError ¶
Bases: ValueError
A policy file is invalid. The message says which rule it broke.
PolicySet ¶
Bases: tuple[Policy, ...]
Policies with unique ids, in a stable order.
SelfTestError ¶
Bases: RuntimeError
A core policy gave the wrong answer on a known example.
VerdictError ¶
Bases: Exception
The verdict does not verify, or is about a different subject or revision.
parse_model_verdict ¶
The verdict, or None when the answer is not strict JSON in the schema.
parse_policy ¶
Validate one policy document. source="pack" forbids quarantine.
run_selftest ¶
Raise SelfTestError unless every example gets its expected action and policy.
verify_verdict ¶
verify_verdict(
signed: SignedVerdict,
public_key: Ed25519PublicKey,
*,
event_id: str,
revision: int,
expected_kid: str | None = None,
) -> VerdictBody
Check the signature and that it covers this event and revision. Raises VerdictError.