Skip to main content

Guardrail

This page is auto-generated from the formations OpenAPI spec. Do not edit manually — run pnpm generate-formations-resource-docs to regenerate.

Creates a guardrail — an action-class document (class/guard) that gates tool-call autonomy. Attach it to a tool or agent via that resource's guardrail_ids (a { "ref": … } to this resource in the same template resolves to its physical id at deploy time). Mirrors the guardrails REST contract; class/default_class/guard/escalate are flattened here from the REST API's single document object.

Syntax

type: guardrail
properties:
name: String
description: String
class: Any
default_class: String
guard: Object
escalate: Boolean
context_tool_id: String
context_mode: String

Output

The physical resource ID is the public ID of the created resource. Reference it from other resources with a ref expression:

some_field:
ref: MyGuardrail

Properties

name

Human-readable name

Required: Yes Type: String


description

Optional description

Required: No Type: String Nullable: Yes


class

A class literal (A / B / C / D) or a JSON Logic expression returning one. An invalid result resolves to default_class.

Required: Yes Type: Any


default_class

Applied when the class expression returns anything other than a valid class. Defaults to C (fail-closed).

Required: No Type: String Nullable: Yes


guard

A single JSON Logic expression; when the call classifies as B it executes only if this evaluates truthy.

Required: No Type: Object Nullable: Yes


escalate

When true, a passing guard still files an approval item.

Required: No Type: Boolean Nullable: Yes


context_tool_id

Optional tool the platform calls at evaluation time to fetch fresh guardrail context.

Required: No Type: String Nullable: Yes


context_mode

How tool-fetched context combines with the caller-supplied context.

Required: No Type: String Nullable: Yes