Skip to content

Guardrail

Guardrail

Bases: BaseModel

Represents a guardrail definition.

A guardrail is a security or content moderation mechanism that can be applied to pipelines, agents, and other entities. Guardrails contain filters for detecting specific content types and assignments that determine where they are applied.

Attributes:

Name Type Description
id str

The unique identifier of the guardrail

name str

The friendly display name of the guardrail

description str

A description of what the guardrail does

enabled bool

Whether the guardrail is currently enabled

apply_datasource bool

Whether the guardrail should be applied to datasources

apply_to_tools bool

Whether the guardrail should be applied to tool responses

filters List[GuardrailFilter]

List of filters that define what the guardrail detects

guardrail_assignments List[GuardrailAssignment]

List of entity assignments for the guardrail

guardrail_targets List[GuardrailTarget]

List of target configurations for the guardrail

GuardrailAssignment

Bases: BaseModel

Represents a guardrail assignment definition.

Assignments define which entities (tenants, projects, agents, etc.) a guardrail is applied to. This allows for granular control over guardrail application across the organization hierarchy.

Attributes:

Name Type Description
entity_type str

The type of entity (e.g., Tenant, Project, Agent, Model, Datasource)

entity_id str

The unique identifier of the assigned entity

project_id Optional[str]

Optional project identifier if the entity belongs to a project

GuardrailFilter

Bases: BaseModel

Represents a base filter definition within a guardrail.

Filters define the specific detection or processing rules that a guardrail applies to content. Each filter has a type indicating what kind of content it processes (e.g., PII, PCI, moderation).

Attributes:

Name Type Description
enabled bool

Whether the filter is currently enabled

guardrail_id str

The unique identifier of the parent guardrail

tenant_id str

The tenant identifier this filter belongs to

filter_type str

The type of filter (e.g., Pci, Pii, Phi, Moderation, PromptInjection)

GuardrailTarget

Bases: BaseModel

Guardrail target definition.

Targets specify how guardrails are applied to different entities, including whether they apply to input, output, or both, and whether they represent inclusions or exclusions.

Attributes:

Name Type Description
entity_type str

The type of entity (e.g., Tenant, Project, Agent, Model)

target_type str

Where the guardrail applies (None, Input, Output, Both)

is_exception bool

Whether assignments represent exclusions rather than inclusions. When true, the guardrail applies to all entities EXCEPT those in the assignment list. When false (default), the guardrail applies ONLY to entities in the assignment list.