Skip to main content

Gates

A Gate is a decision point in an Op: the results of one or more Guards determine what happens next. Guards check; Gates decide. The idea, and the word, are those of the Intelligence Hub whitepaper (section 5.2).

Not every failure is the same โ€” some need a correction, some a review, some an escalation, some a stop โ€” and a Gate writes that decision into the workflow. It is also where the autonomy an Op was granted ends: the point at which a person can interpret an output, decline it, override it or stop the work.

# gates/low-confidence-review.yaml
id: low-confidence-review
version: 0.0.1
name: Low Confidence Review

stage: post_run
guards:
- confidence-guard:0.0.1
when: confidence < 0.80
then: human_review_required
otherwise: proceed
reviewers:
- op-owner

Fieldsโ€‹

FieldMeaning
id, version, name, descriptionAs on every spec.
stageThe stage of an Op the decision is made at.
guardsThe Guards whose results the Gate reads.
whenThe condition, on the signals its Guards report. always for a Gate every run goes through. Required.
thenWhat happens when the condition holds. Required.
otherwiseWhat happens when it does not; proceed by default.
reviewersThe roles the decision is handed to. Required when either then or otherwise hands it to a person.
max_retriesHow many times retry may be decided. Required, at least 1, when it can be.
enabledWhether an Op may name it today.

Conditionsโ€‹

A condition is a signal on its own โ€” true when the Guard reported it โ€” or a comparison of one with a number, true, false or a word; several are joined by and or or.

when: sensitive_data_detected
when: confidence < 0.80
when: schema_valid == false or unsupported_claims > 0
when: vendor_risk == high
when: always

It is deliberately not a language: nothing is evaluated here, and a condition that does not read this way is refused, as is one that reads a signal none of the Gate's Guards reports.

Actionsโ€‹

ActionWhat it decides
proceedThe work goes on.
pauseThe work waits for a revision.
retryThe step is run again, possibly by another Cog.
additional_validationMore Guards are run before deciding.
human_review_requiredA person reviews the output before it is used.
human_approval_requiredA person approves before the action is taken.
expert_review_requiredA named expert reviews.
stopThe Op ends.
stop_and_escalateThe Op ends and somebody is told.

The catalogueโ€‹

IdStageWhenThen
configuration-checkpreflighta Frame is missing, a permission denied or a source unauthorizedstop_and_escalate
sensitive-data-stopin_flightsensitive_data_detectedstop_and_escalate
tool-violation-retryin_flighttool_violationretry (twice)
low-confidence-reviewpost_runconfidence < 0.80human_review_required
unsupported-claims-revisionpost_runschema_valid == false or unsupported_claims > 0pause
consensus-disagreement-reviewpost_runconsensus_disagreement > 0.25expert_review_required
release-approvalpost_runalwayshuman_approval_required
quality-drift-reviewcontinuousregression_rate > 0.10 or outcome_met == falseexpert_review_required

In Pythonโ€‹

from agentspecs.gates import get_gate, signals_of

gate = get_gate("low-confidence-review")
gate.then, gate.signals # GateAction.HUMAN_REVIEW_REQUIRED, ['confidence']
signals_of("schema_valid == false or unsupported_claims > 0")