Skip to main content

Guards

A Guard is a reusable verification and protection component: it checks whether the output or the action of a Cog or an Op is correct, safe, policy-compliant and ready for use. Guards check; Gates decide. The idea, and the word, are those of the Intelligence Hub whitepaper (section 5.1).

A Guard extends a guardrailโ€‹

A guardrail is a policy: what may be read, written, executed and sent, how much, and how data is handled. It bounds what an agent may do โ€” and nothing in it verifies that the bounds held. A Guard is that verification.

extends names the guardrail, by the extension mechanism every spec uses. The resolved Guard carries the guardrail's policy โ€” the standard it checks against, and the bounds it runs within when the Guard is itself a Cog or a person โ€” with what the Guard adds.

# guards/sensitive-data-guard.yaml
id: sensitive-data-guard
version: 0.0.1
name: Sensitive Data Guard

extends: restricted-viewer:0.0.1 # the guardrail: its denied fields, its redaction

category: policy-safety
stages:
- in_flight
- post_run
method: algorithmic

check: >-
No output, tool argument or outbound message contains a credential, a field
matching the guardrail's denied fields, or personal data the guardrail's
handling rules require to be redacted.

signals:
- name: sensitive_data_detected
type: boolean
description: Sensitive data was found where it must not be.

required: true

Fieldsโ€‹

FieldMeaning
id, version, name, descriptionAs on every spec.
extendsThe guardrail the Guard extends. Required.
categoryWhich of the seven categories it is. Required.
stagesThe stages of an Op it may run at: preflight, in_flight, post_run, continuous. Required.
methodHow the check is made: algorithmic (code), cog (a Cog judges), human (a person judges).
checkWhat is verified, written so that code, a Cog or a person can run it. Required.
signalsWhat it reports beside pass or fail โ€” name, type (boolean, number, string) โ€” for a Gate's condition to read.
requiredWhether the work counts only once the Guard has passed.
enabledWhether an Op may name it today.
any guardrail fieldOverrides the guardrail's, by the merge semantics.

Categories and stagesโ€‹

CategoryWhat it verifies
algorithmicAn output against a deterministic rule or a known result.
source-groundingClaims are supported by approved evidence.
consensusIndependent Cogs, prompts or models agree.
expertA person judges sampled or high-risk outputs.
policy-safetyThe work stays inside what is allowed.
regression-driftAn update has not changed behavior unacceptably.
outcomeThe intended result is produced.
StageThe question
preflightIs this Op allowed and properly configured?
in_flightIs the work staying within policy and expected bounds?
post_runIs the output correct, useful, safe and ready for action?
continuousIs quality improving, degrading or drifting over time?

The catalogueโ€‹

IdCategoryStagesMethodExtends
required-frame-guardpolicy-safetypreflightalgorithmicdefault-platform-user
permission-guardpolicy-safetypreflightalgorithmicdefault-platform-user
data-source-authorization-guardpolicy-safetypreflightalgorithmicdata-engineering-power-user
tool-use-policy-guardpolicy-safetyin_flightalgorithmicdefault-platform-user
sensitive-data-guardpolicy-safetyin_flight, post_runalgorithmicrestricted-viewer
confidence-guardalgorithmicin_flight, post_runalgorithmicdefault-platform-user
schema-guardalgorithmicpost_runalgorithmicdefault-platform-user
source-grounding-guardsource-groundingpost_runcogdefault-platform-user
consensus-guardconsensuspost_runcogdefault-platform-user
expert-sampling-guardexpertpost_runhumandefault-platform-user
regression-guardregression-driftcontinuousalgorithmicdata-engineering-power-user
outcome-guardoutcomecontinuoushumandefault-platform-user

Guards declared by a Frameโ€‹

A Frame declares, inline, the checks its own context implies (totals-reconcile on the Sales Pipeline Frame). They travel with the Frame and reach an Op through its Cogs, as frame_guards. A Guard of this catalogue is the reusable kind: it extends a guardrail, reports signals, and is named by an Op at a stage.

In Pythonโ€‹

from agentspecs.guards import get_resolved_guard, guards_extending

guard = get_resolved_guard("sensitive-data-guard")
guard["guardrail"] # 'restricted-viewer'
guard["data_handling"]["pii_action"] # 'redact' โ€” the guardrail's policy
[g.id for g in guards_extending("restricted-viewer")]

A Guard that extends nothing, or something that is not a guardrail, names no stage or no check is refused when the catalogue loads.