Skip to content

GuardrailResult

The result of a guardrail evaluation. Guardrails are safety checks that run at specific phases of the agent loop and can allow, deny, or rewrite content.

---
title: GuardrailResult
config:
  look: handDrawn
  theme: colorful
  class:
    hideEmptyMembersBox: true
---
classDiagram
    class GuardrailResult {
        +boolean allowed
        +string reason
        +unknown rewrite
    }
allowed: true
reason: Content is safe
NameTypeDescription
allowedbooleanWhether the content passed the guardrail check
reasonstringExplanation of why the content was allowed or denied
rewriteunknownOptional rewritten content to replace the original

The following factory methods are declared via @factory and are generated automatically by the emitter in every language.

  • rewrite(rewrite: unknown)
  • deny(reason: string)
  • allow()