Skip to main content

Enumeration: GuardrailAction

Defined in: packages/agentos/src/safety/guardrails/IGuardrailService.ts:33

High-level outcome emitted by a guardrail evaluation.

The action instructs AgentOS how to handle evaluated content:

Example​

// Allow content to pass
return { action: GuardrailAction.ALLOW };

// Block harmful content
return {
action: GuardrailAction.BLOCK,
reason: 'Content violates policy',
reasonCode: 'POLICY_VIOLATION'
};

// Redact sensitive information
return {
action: GuardrailAction.SANITIZE,
modifiedText: text.replace(/\b\d{3}-\d{2}-\d{4}\b/g, '[SSN REDACTED]')
};

Enumeration Members​

ALLOW​

ALLOW: "allow"

Defined in: packages/agentos/src/safety/guardrails/IGuardrailService.ts:38

Allow the content to pass through unchanged. Use when content passes all policy checks.


BLOCK​

BLOCK: "block"

Defined in: packages/agentos/src/safety/guardrails/IGuardrailService.ts:58

Block the interaction entirely and return an error to the host. Use for policy violations, harmful content, or security threats. Terminates the stream immediately when used in output evaluation.


FLAG​

FLAG: "flag"

Defined in: packages/agentos/src/safety/guardrails/IGuardrailService.ts:44

Allow the request/response but record metadata for analytics or audit. Content passes through, but the evaluation is logged for review.


SANITIZE​

SANITIZE: "sanitize"

Defined in: packages/agentos/src/safety/guardrails/IGuardrailService.ts:51

Continue processing after replacing content with a sanitized version. Use for PII redaction, profanity filtering, or content modification. Requires GuardrailEvaluationResult.modifiedText to be set.